home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / dev / src / sg_mgsrc.lha / flttext.s < prev    next >
Text File  |  1995-04-30  |  72KB  |  3,094 lines

  1. ;    ==================================================================
  2. ;    NAME: FltText            VERSION: 2.01
  3. ;    AUTHOR:    Richard Tew  aka  Soltan Gris
  4. ;    NOTE: The conditions of distrution are:-
  5. ;        a) You may not redistribute this archive in any other form,
  6. ;            but keep in mind you may use the contents in your own
  7. ;            productions, if and only if you credit me .. in plain
  8. ;            sight :)
  9. ;        b) You may not use/read any further this archive, unless
  10. ;            you agree to the terms of uploadware :), that is:
  11. ;            - If you use the contents of this archive,
  12. ;               you must upload any sources, at least one of
  13. ;               your own to Aminet, or if you have no ftp access
  14. ;               to a local BBS.
  15. ;    IMPORTANT: Condition b) overrides a) if this makes sense..
  16. ;    ------------------------------------------------------------------
  17. ;    $VER: FltText V2.01 (08/11/94)
  18. ;    ------------------------------------------------------------------
  19. ;                    Includes
  20. ;    ------------------------------------------------------------------
  21.  
  22.     incdir    "Include2.0:"
  23.     include    "hardware/customregisters.i"
  24.     include    "intuition/intuition.i"
  25.     include    "exec/exec_lib.i"
  26.     include    "exec/memory.i"
  27.     include    "exec/interrupts.i"
  28.     include    "exec/nodes.i"
  29.     include    "dos/dos_lib.i"
  30.     include    "dos/dos.i"
  31.     include    "intuition/intuition_lib.i"
  32.     include    "graphics/gfxbase.i"
  33.     
  34. ;    ------------------------------------------------------------------
  35. ;                     Equates
  36. ;    ------------------------------------------------------------------
  37.  
  38. wk_QuitFlag        equ    0
  39. wk_Buffer        equ    wk_QuitFlag+4
  40.  
  41. wk_Bitplane1        equ    wk_Buffer+4
  42. wk_Bitplane2        equ    wk_Bitplane1+4
  43. wk_Bitplane3        equ    wk_Bitplane2+4
  44. wk_Bitplane4        equ    wk_Bitplane3+4
  45. wk_DoubleBuffer        equ    wk_Bitplane4+4
  46.  
  47. wk_DosBase        equ    wk_DoubleBuffer+4
  48. wk_IntuiBase        equ    wk_DosBase+4
  49.  
  50. wk_DMAConSave        equ    wk_IntuiBase+4
  51. wk_IntenaSave        equ    wk_DMAConSave+2
  52.  
  53. wk_CursXCoord        equ    wk_IntenaSave+2
  54. wk_CursYCoord        equ    wk_CursXCoord+2
  55.  
  56. wk_OldJoy0Dat        equ    wk_CursYCoord+2
  57. wk_KeyBuffer        equ    wk_OldJoy0Dat+2
  58. wk_SpriteXCoord        equ    wk_KeyBuffer+2
  59. wk_SpriteYCoord        equ    wk_SpriteXCoord+2
  60. wk_OldJoy1Dat        equ    wk_SpriteYCoord+2
  61.  
  62. wk_CharBuffer        equ    wk_OldJoy1Dat+2
  63.  
  64. wk_BlankSprite        equ    wk_CharBuffer+4
  65.  
  66. wk_IrqStruct        equ    wk_BlankSprite+80
  67.  
  68. wk_PrintCounter        equ    wk_IrqStruct+30
  69.  
  70. wk_FileNamePtr        equ    wk_PrintCounter+2
  71. wk_LockHandle        equ    wk_FileNamePtr+4
  72. wk_FileHandle        equ    wk_LockHandle+4
  73.  
  74. wk_FileSize        equ    wk_FileHandle+4
  75. wk_FileBufferPtr    equ    wk_FileSize+4
  76. wk_OldFileSize        equ    wk_FileBufferPtr+4
  77. wk_OldFileBufferPtr    equ    wk_OldFileSize+4
  78.  
  79. wk_FileInfoBlock    equ    wk_OldFileBufferPtr+4
  80. wk_OldAutoRequest    equ    wk_FileInfoBlock+fib_SIZEOF+4
  81.  
  82. wk_IndexSize        equ    wk_OldAutoRequest+4
  83. wk_IndexBufferPtr    equ    wk_IndexSize+4
  84. wk_PageNameBuffer    equ    wk_IndexBufferPtr+4
  85. wk_PageSize        equ    wk_PageNameBuffer+50
  86. wk_PageBufferPtr    equ    wk_PageSize+4
  87. wk_DecrunchedFileSize    equ    wk_PageBufferPtr+4
  88. wk_DecrunchedFilePtr    equ    wk_DecrunchedFileSize+4
  89.  
  90. wk_CurrentNumber    equ    wk_DecrunchedFilePtr+4
  91. wk_CurrentLineNum    equ    wk_CurrentNumber+2
  92. wk_OwnerFlag        equ    wk_CurrentLineNum+4
  93. wk_PageTablePtr        equ    wk_OwnerFlag+4
  94. wk_PageTableSize    equ    wk_PageTablePtr+4
  95. wk_PageNumLines        equ    wk_PageTableSize+4
  96. wk_PageOffsetPtr    equ    wk_PageNumLines+4
  97.  
  98. wk_SpecOffset1Ptr    equ    wk_PageOffsetPtr+4
  99. wk_SpecOffset2Ptr    equ    wk_SpecOffset1Ptr+4
  100. wk_SpecNumLines        equ    wk_SpecOffset2Ptr+4
  101. wk_SpecLineNum        equ    wk_SpecNumLines+4
  102. wk_SpecArticleFlag    equ    wk_SpecLineNum+4
  103.  
  104. Workspace_SizeOf    equ    wk_SpecArticleFlag+4
  105.  
  106. ;    ------------------------------------------------------------------
  107. ;                    Constants
  108. ;    ------------------------------------------------------------------
  109.  
  110. ;    Code:
  111. ;    a6=ExecBase
  112. ;    a5=Custom
  113. ;    a4=Workspace
  114.  
  115. NumberOfPlanes    equ    4
  116. ScreenWidth    equ    640
  117. ScreenHeight    equ    256
  118. BytesPerLine    equ    ScreenWidth/8
  119.  
  120. LogoWidth    equ    224
  121. LogoHeight    equ    32
  122. LogoDepth    equ    4
  123. LogoBWidth    equ    LogoWidth/8
  124.  
  125. CursorYMinimum    equ    6
  126. CursorYMaximum    equ    28
  127.  
  128. OneSecond    equ    TICKS_PER_SECOND
  129.  
  130. TAB        equ    9
  131.  
  132. ON        equ    1
  133. OFF        equ    0
  134. OWNER        equ    OFF
  135.  
  136. ;    ==================================================================
  137. ;                Start of the Code
  138. ;    ------------------------------------------------------------------
  139.  
  140.     SECTION    DMClone,CODE
  141.     
  142.     move.l    4.w,a6
  143.     jsr    _LVOForbid(a6)
  144.  
  145.     bsr    Setup
  146.     tst.l    d0
  147.     bne    SetupError
  148.  
  149. ;    ------------------------------------------------------------------
  150.  
  151.     lea    EntropyTitleCTxt(pc),a0
  152.     bsr    PrintString
  153.  
  154.     cmp.b    #ON,wk_OwnerFlag(a4)
  155.     bne.s    SkipMouseCrap
  156.  
  157.     lea    ProgramDataCTxt(pc),a0
  158.     bsr    PrintString
  159.     bsr    PrintCoords
  160.  
  161. SkipMouseCrap
  162.  
  163. ;    ------------------------------------------------------------------
  164.  
  165.     bsr    OpenDos
  166.     tst.l    d0
  167.     bne    DosError
  168.  
  169.     bsr    OpenIntui
  170.     tst.l    d0
  171.     bne    IntuiError
  172.  
  173. ;    ------------------------------------------------------------------
  174.  
  175.     cmp.b    #OFF,wk_OwnerFlag(a4)
  176.     beq.s    su_SkipReadText1
  177.  
  178.     lea    ReadingFile1Txt(pc),a0
  179.     bsr    PrintText
  180.  
  181. su_SkipReadText1
  182.  
  183.     lea    IndexName(pc),a0
  184.  
  185.     cmp.b    #OFF,wk_OwnerFlag(a4)
  186.     beq.s    su_SkipReadText2
  187.  
  188.     move.l    a0,-(sp)
  189.     bsr    PrintText
  190.     lea    ReadingFile2Txt(pc),a0
  191.     bsr    PrintText
  192.     move.l    (sp)+,a0
  193.  
  194. su_SkipReadText2
  195.  
  196.     move.l    a0,d0
  197.     bsr    ReadFile
  198.     tst.l    d0
  199.     bne    Error
  200.     move.l    d1,wk_IndexBufferPtr(a4)
  201.     move.l    d2,wk_IndexSize(a4)
  202.  
  203.     cmp.b    #OFF,wk_OwnerFlag(a4)
  204.     beq.s    su_SkipReadyText
  205.  
  206.     lea    ReadyTxt(pc),a0
  207.     bsr    PrintText
  208. su_SkipReadyText
  209.  
  210.     moveq    #0,d0
  211.     move.l    d0,wk_FileSize(a4)    ; Clear so not freed twice
  212.     move.l    d0,wk_FileBufferPtr(a4)    ;  " "  "   "   " "   "  "
  213.  
  214.     bsr    DecrunchIndex
  215.     tst.l    d0
  216.     bne.s    ni_Continue
  217.  
  218.     move.l    wk_IndexBufferPtr(a4),a0
  219.     cmp.l    #'INDX',(a0)
  220.     bne    NotIndexFile
  221.  
  222.     lea    TitleName(pc),a0
  223.     lea    IndexTitle(pc),a1
  224.     bsr    ReadPage
  225.  
  226. ;    ------------------------------------------------------------------
  227.  
  228.     lea    TitleText(pc),a0
  229.     bsr    PrintString
  230.  
  231. ;    ------------------------------------------------------------------
  232.  
  233. MainLoop:
  234.     bsr    CheckKeys
  235.     bsr    CheckSpriteSelection
  236.  
  237.     tst.b    wk_QuitFlag(a4)
  238.     beq.s    MainLoop
  239.  
  240. ;    -----------------------------------------------------------------
  241.  
  242.  
  243.     tst.l    wk_PageSize(a4)
  244.     beq.s    Error
  245.     move.l    wk_PageSize(a4),d0
  246.     move.l    wk_PageBufferPtr(a4),a1
  247.     bsr    FreeMem
  248.  
  249. ni_Continue
  250.     tst.l    wk_IndexSize(a4)
  251.     beq.s    Error
  252.     move.l    wk_IndexSize(a4),d0
  253.     move.l    wk_IndexBufferPtr(a4),a1
  254.     bsr    FreeMem
  255.  
  256. ;    -----------------------------------------------------------------
  257.     
  258. Error
  259.     bsr    CloseIntui
  260. IntuiError
  261.     bsr    CloseDos
  262. DosContinue
  263.     bsr    CloseDown
  264.  
  265. Exit    jsr    _LVOPermit(a6)
  266.     moveq    #0,d0
  267.     rts
  268.  
  269. ;    =================================================================
  270. ;    FUNCTION:    Setup
  271. ;    USAGE:        To set up the general set up stuff i.e. interrup-
  272. ;            ts, copperlists.....
  273. ;    INPUTS:        None
  274. ;    OUTPUTS:    a4    =    Workspace address
  275. ;            a5    =    Custom Hardware
  276. ;    ------------------------------------------------------------------
  277.  
  278. Setup    lea    _custom,a5            ; Store Custom address
  279.  
  280.     move.l    #Workspace_SizeOf,d0
  281.     move.l    #(MEMF_CLEAR!MEMF_PUBLIC),d1
  282.     jsr    _LVOAllocMem(a6)
  283.     move.l    d0,a4                ; Store Workspace address
  284.     lea    MemAddress(pc),a0
  285.     move.l    d0,(a0)
  286.     beq    WorkMemAllocError
  287.  
  288. ;    ------------------------------------------------------------------
  289. ;    Save all the REALLY IMPORTANT variables for later restoral
  290. ;    so the system can be left as it was on exit...
  291.  
  292.     move.w    dmaconr(a5),wk_DMAConSave(a4)
  293.     move.w    intenar(a5),wk_IntenaSave(a4)
  294.  
  295. ;    He he .. get initial joy and mouse datas.
  296.  
  297.     move.w    joy0dat(a5),wk_OldJoy0Dat(a4)
  298.     move.w    joy1dat(a5),wk_OldJoy1Dat(a4)
  299.  
  300. ;    ------------------------------------------------------------------
  301. ;    Initialize all the important variables:
  302.  
  303.     move.w    #000,wk_SpriteXCoord(a4)        ; Mouse coordinates
  304.     move.w    #000,wk_SpriteYCoord(a4)        ;   "      "   "
  305.     clr.w    wk_CursXCoord(a4)            ; Cursor coordinates
  306.     move.w    #CursorYMinimum,wk_CursYCoord(a4)    ;   "      "   "
  307.     move.w    #'00',wk_CurrentNumber(a4)        ; Initial page number
  308.     move.b    #OWNER,wk_OwnerFlag(a4)            ; Owner status
  309.     clr.w    wk_PrintCounter(a4)
  310.  
  311. ;    ------------------------------------------------------------------
  312. ;    Allocate the double buffer for the smooth switches..
  313. ;    Chip for the custom hardwares use...
  314.  
  315.     move.l    #((ScreenWidth*ScreenHeight)/8),d0
  316.     move.l    #(MEMF_CLEAR!MEMF_CHIP),d1
  317.     jsr    _LVOAllocMem(a6)
  318.  
  319.     move.l    d0,wk_DoubleBuffer(a4)
  320.     beq    DblBufferAllocError
  321.  
  322. ;    ------------------------------------------------------------------
  323. ;    Allocate the display memory for the NumberOfPlanes bitplanes
  324. ;    Chip memory used for the custom hardware...
  325.     
  326.     move.l    #NumberOfPlanes*((ScreenWidth*ScreenHeight)/8),d0
  327.     move.l    #(MEMF_CLEAR!MEMF_CHIP),d1
  328.     jsr    _LVOAllocMem(a6)
  329.  
  330.     move.l    d0,wk_Bitplane1(a4)
  331.     beq    PlaneMem1AllocError
  332.     lea    CprPln1,a0
  333.     bsr    InstallAddrToCopper
  334.  
  335.     add.l    #((ScreenWidth*ScreenHeight)/8),d0
  336.     move.l    d0,wk_Bitplane2(a4)
  337.     lea    CprPln2,a0
  338.     bsr    InstallAddrToCopper
  339.  
  340.     add.l    #((ScreenWidth*ScreenHeight)/8),d0
  341.     move.l    d0,wk_Bitplane3(a4)
  342.     lea    CprPln3,a0
  343.     bsr    InstallAddrToCopper
  344.  
  345.     add.l    #((ScreenWidth*ScreenHeight)/8),d0
  346.     move.l    d0,wk_Bitplane4(a4)
  347.     lea    CprPln4,a0
  348.     bsr    InstallAddrToCopper
  349.  
  350. ;    ------------------------------------------------------------------
  351.  
  352.     lea    CprSpr1,a0
  353.     lea    wk_BlankSprite(a4),a1    ; Default pointer is none..
  354.     move.l    a1,d0
  355.  
  356.     cmp.b    #OFF,wk_OwnerFlag(a4)    ; If the owner flag is set
  357.     beq.s    su_SpriteOff
  358.  
  359.     move.l    #SpriteData,d0        ; turn the sprites on
  360.  
  361. su_SpriteOff
  362.     bsr    InstallAddrToCopper    ; Set sprite pointer
  363.  
  364. ;    ------------------------------------------------------------------
  365. ;    Clear all the unused sprites.
  366.  
  367.     lea    CprSpr2,a0
  368.     lea    wk_BlankSprite(a4),a1
  369.     move.l    a1,d0
  370.     bsr    InstallAddrToCopper
  371.     lea    CprSpr3,a0
  372.     lea    wk_BlankSprite(a4),a1
  373.     move.l    a1,d0
  374.     bsr    InstallAddrToCopper
  375.     lea    CprSpr4,a0
  376.     lea    wk_BlankSprite(a4),a1
  377.     move.l    a1,d0
  378.     bsr    InstallAddrToCopper
  379.     lea    CprSpr5,a0
  380.     lea    wk_BlankSprite(a4),a1
  381.     move.l    a1,d0
  382.     bsr    InstallAddrToCopper
  383.     lea    CprSpr6,a0
  384.     lea    wk_BlankSprite(a4),a1
  385.     move.l    a1,d0
  386.     bsr    InstallAddrToCopper
  387.     lea    CprSpr7,a0
  388.     lea    wk_BlankSprite(a4),a1
  389.     move.l    a1,d0
  390.     bsr    InstallAddrToCopper
  391.     lea    CprSpr8,a0
  392.     lea    wk_BlankSprite(a4),a1
  393.     move.l    a1,d0
  394.     bsr    InstallAddrToCopper
  395.  
  396. ;    ------------------------------------------------------------------
  397. ;    Draw in logo!!!
  398.  
  399.     lea    EntropyLogo,a0            ; Aaargh, no PC relativity
  400.     move.l    wk_Bitplane1(a4),a1
  401.     lea    ((BytesPerLine-LogoBWidth)/2)(a1),a1
  402.     move.l    a1,a2
  403.  
  404.     moveq    #LogoDepth-1,d5
  405. CopyLogo
  406.     moveq    #LogoHeight-1,d7        ;Height
  407.     moveq    #LogoBWidth-1,d6        ;Width
  408. CopyAPlane
  409.     move.b    (a0)+,(a1)+
  410.     dbra    d6,CopyAPlane
  411.  
  412.     moveq    #LogoBWidth-1,d6        ;Set Next Line Width
  413.     add.w    #BytesPerLine-LogoBWidth,a1    ;Logo NL Strt Amount
  414.     dbra    d7,CopyAPlane
  415.  
  416.     lea    (BytesPerLine*ScreenHeight)(a2),a2
  417.     move.l    a2,a1
  418.  
  419.     dbra    d5,CopyLogo
  420.  
  421. ;    ------------------------------------------------------------------
  422. ;    Install our copperlist.
  423.  
  424.     lea    CopperList,a0
  425.     move.l    a0,cop1lch(a5)
  426.     clr.w    copjmp1(a5)
  427.  
  428.     move.w    #0,spr0ctl(a5)
  429.     move.w    #0,spr1ctl(a5)
  430.     move.w    #0,spr2ctl(a5)
  431.     move.w    #0,spr3ctl(a5)
  432.     move.w    #0,spr4ctl(a5)
  433.     move.w    #0,spr5ctl(a5)
  434.     move.w    #0,spr6ctl(a5)
  435.     move.w    #0,spr7ctl(a5)
  436.  
  437. ;    Install our interrupt.
  438.  
  439.     bsr    InstallInterrupt
  440.  
  441. ;    Initialize DMACon.
  442.  
  443.     move.w    #%1000001111100000,dmacon(a5)
  444.     moveq    #0,d0
  445.     rts
  446.  
  447. InstallAddrToCopper
  448.     move.w    d0,6(a0)    ; Install lo-word
  449.     swap    d0
  450.     move.w    d0,2(a0)    ; Install hi-word
  451.     swap    d0
  452.     rts
  453.  
  454. DblBufferAllocError
  455.     moveq    #4,d0        ; No memory for double-buffer
  456.     rts
  457.  
  458. PlaneMem1AllocError
  459.     moveq    #1,d0        ; No memory for display
  460.     rts
  461.  
  462. WorkMemAllocError
  463.     moveq    #3,d0        ; No memory for workspace
  464.     rts
  465.     
  466. SetupError
  467.     cmp.l    #1,d0        ; Handle errors and exiting
  468.     beq.s    PlaneError
  469.     cmp.l    #4,d0
  470.     beq.s    DblBufferError
  471.     bra    Exit
  472.  
  473. PlaneError
  474.     bsr    Plane2Error
  475.     bra    Exit
  476.  
  477. DblBufferError
  478.     bsr    FreeWorkMem
  479.     bra    Exit    
  480.  
  481. ;    ======================================================================
  482. ;    Open intuition.library for use in handling Autorequest.
  483.  
  484. OpenIntui
  485.     lea    IntuiName(pc),a1
  486.     jsr    _LVOOldOpenLibrary(a6)
  487.     move.l    d0,wk_IntuiBase(a4)
  488.     beq.s    oi_OpenError
  489.  
  490.     move.l    d0,a1
  491.     move.l    _LVOAutoRequest+2(a1),wk_OldAutoRequest(a4)
  492.     lea    AutoRequest(pc),a0
  493.     move.l    a0,_LVOAutoRequest+2(a1)
  494.  
  495.     moveq    #0,d0
  496.     rts
  497.  
  498. oi_OpenError
  499.     moveq    #-1,d0        ; Fatal error, no intuition library!!!!!!
  500.     rts
  501.  
  502. ;    ======================================================================
  503.  
  504. AutoRequest:
  505.     move.l    a3,-(sp)
  506.     move.l    a2,-(sp)
  507.     move.l    a1,-(sp)
  508.     move.l    4.w,a6
  509.     lea    $dff000,a5        ; Set our values
  510.     move.l    MemAddress(pc),a4
  511.     
  512.     jsr    _LVOPermit(a6)        ; Restore multitasking
  513.     bsr    RemoveInterrupt        ; Restore old interrupt
  514.  
  515.     bsr    ClearText
  516.     lea    AutoRequestTxt(pc),a0
  517.     bsr    PrintText
  518.  
  519.     move.l    (sp)+,a0
  520. ar_PrintErrorString
  521.     move.l    a0,-(sp)
  522.     move.l    it_IText(a0),a0        ; Get the stupid text
  523.     bsr    PrintText        ; We all know what its gonna be...
  524.     addq.w    #1,wk_CursXCoord(a4)    ; Naughty, should only be changed
  525.     move.l    (sp)+,a0        ; by a print routine.....
  526.     tst.l    it_NextText(a0)
  527.     beq.s    ar_NoMoreText
  528.     move.l    it_NextText(a0),a0
  529.     bra.s    ar_PrintErrorString
  530.  
  531. ar_NoMoreText
  532.     lea    LeftButtonTxt(pc),a0
  533.     bsr    PrintText
  534.     move.l    (sp)+,a0
  535. ar_PrintLeftOptions
  536.     move.l    a0,-(sp)
  537.     move.l    it_IText(a0),a0        ; Get the stupid text
  538.     bsr    PrintText        ; We all know what its gonna be...
  539.     addq.w    #1,wk_CursXCoord(a4)    ; Naughty, should only be changed
  540.     move.l    (sp)+,a0        ; by a print routine.....
  541.     tst.l    it_NextText(a0)
  542.     beq.s    ar_NoMoreLeftOptions
  543.     move.l    it_NextText(a0),a0
  544.     bra.s    ar_PrintLeftOptions
  545.  
  546. ar_NoMoreLeftOptions
  547.     lea    RightButtonTxt(pc),a0
  548.     bsr    PrintText
  549.     move.l    (sp)+,a0
  550. ar_PrintRightOptions
  551.     move.l    a0,-(sp)
  552.     move.l    it_IText(a0),a0        ; Get the stupid text
  553.     bsr    PrintText        ; We all know what its gonna be...
  554.     addq.w    #1,wk_CursXCoord(a4)    ; Naughty, should only be changed
  555.     move.l    (sp)+,a0        ; by a print routine.....
  556.     tst.l    it_NextText(a0)
  557.     beq.s    ar_NoMoreRightOptions
  558.     move.l    it_NextText(a0),a0
  559.     bra.s    ar_PrintRightOptions
  560.  
  561. ar_NoMoreRightOptions
  562.     lea    RequesterChoiceTxt(pc),a0
  563.     bsr    PrintText
  564. ar_WaitMouseButton
  565.     btst    #6,ciaapra
  566.     beq.s    ar_Retry
  567.     btst    #10,potinp(a5)
  568.     bne.s    ar_WaitMouseButton
  569.     moveq    #12-1,d0
  570. ar_Cancel
  571.     btst    #10,potinp(a5)
  572.     beq.s    ar_Cancel
  573.     dbra    d0,ar_Cancel
  574.     bsr    InstallInterrupt
  575.     jsr    _LVOForbid(a6)
  576.     moveq    #0,d0
  577.     rts
  578.  
  579. ar_Retry
  580.     moveq    #12-1,d0
  581. ar_WaitNoLMouse
  582.     btst    #6,ciaapra
  583.     beq.s    ar_WaitNoLMouse
  584.     dbra    d0,ar_WaitNoLMouse
  585.     bsr    InstallInterrupt
  586.     jsr    _LVOForbid(a6)
  587.     moveq    #1,d0
  588.     rts
  589.  
  590. NextLine
  591.     clr.w    wk_CursXCoord(a4)
  592.     addq.l    #1,wk_CursYCoord(a4)
  593.     rts
  594.  
  595. ;    ======================================================================
  596.  
  597. OpenDos
  598.     lea    DosLibName(pc),a1
  599.     jsr    _LVOOldOpenLibrary(a6)
  600.     move.l    d0,wk_DosBase(a4)
  601.     beq.s    od_OpenError
  602.     moveq    #0,d0
  603.     rts
  604.  
  605. od_OpenError
  606.     moveq    #-1,d0        ; Fatal error, cannot open DOS!!!
  607.     rts
  608.  
  609. DosError
  610.     bsr    ClearText
  611.     lea    DosErrorCTxt(pc),a0
  612.     bsr    PrintString
  613.     bsr    WaitMouse
  614.     bra    DosContinue
  615.  
  616. ;    ======================================================================
  617. ;    FUNCTION: ReadFile
  618. ;    USE:      To read a file into a allocated buffer
  619. ;    PARAMS:      d0 - Address of filename
  620. ;    RESULT:      d0 - Error status
  621. ;             0= No errors
  622. ;            -1= Unable to locate file
  623. ;            -2= Unable to examine file
  624. ;            -3= Unable to allocate file buffer
  625. ;            -4= Unable to open the file
  626. ;          d1 - Address of file buffer
  627. ;          d2 - Length of file buffer
  628.  
  629. ReadFile
  630.     move.l    d0,-(sp)
  631.  
  632.     jsr    _LVOPermit(a6)
  633.  
  634.     move.l    (sp)+,d0
  635.  
  636.     cmp.b    #OFF,wk_OwnerFlag(a4)
  637.     beq.s    rf_SkipLockText
  638.  
  639.     move.l    d0,-(sp)
  640.     lea    LockTxt(pc),a0
  641.     bsr    PrintText
  642.     move.l    (sp)+,d0
  643.  
  644. rf_SkipLockText
  645.  
  646.     move.l    d0,wk_FileNamePtr(a4)
  647.     move.l    d0,d1
  648.     moveq    #ACCESS_READ,d2
  649.     bsr    LockFile
  650.     move.l    d0,wk_LockHandle(a4)
  651.     beq    rf_FileLocationError
  652.  
  653.     cmp.b    #OFF,wk_OwnerFlag(a4)
  654.     beq.s    rf_SkipExamText
  655.  
  656.     move.l    d0,-(sp)
  657.     lea    ExamineTxt(pc),a0
  658.     bsr    PrintText
  659.     move.l    (sp)+,d0
  660.  
  661. rf_SkipExamText
  662.  
  663.     move.l    d0,d1
  664.     lea    wk_FileInfoBlock(a4),a0
  665.     move.l    a0,d2
  666.     bsr    ExamineFile
  667.     tst.l    d0
  668.     beq    rf_ExamineError
  669.  
  670.     cmp.b    #OFF,wk_OwnerFlag(a4)
  671.     beq.s    rf_SkipUnLockText
  672.  
  673.     lea    UnLockTxt(pc),a0
  674.     bsr    PrintText
  675.  
  676. rf_SkipUnLockText
  677.  
  678.     move.l    wk_LockHandle(a4),d1
  679.     bsr    UnLockFile
  680.  
  681.     lea    wk_FileInfoBlock(a4),a0
  682.     move.l    122(a0),wk_FileSize(a4)
  683.     addq.l    #8,wk_FileSize(a4)
  684.  
  685.     move.l    wk_FileSize(a4),d0
  686.     move.l    #(MEMF_CLEAR!MEMF_PUBLIC),d1
  687.     bsr    AllocMem
  688.     move.l    d0,wk_FileBufferPtr(a4)
  689.     beq    rf_NoFileMemoryError
  690.  
  691.     cmp.b    #OFF,wk_OwnerFlag(a4)
  692.     beq.s    rf_SkipOpenText
  693.  
  694.     move.l    d0,-(sp)
  695.     lea    OpenTxt(pc),a0
  696.     bsr    PrintText
  697.     move.l    (sp)+,d0
  698.  
  699. rf_SkipOpenText
  700.  
  701.     move.l    wk_FileNamePtr(a4),d1
  702.     move.l    #MODE_OLDFILE,d2
  703.     bsr    OpenFile
  704.     move.l    d0,wk_FileHandle(a4)
  705.     beq    rf_FileOpenError
  706.  
  707.     cmp.b    #OFF,wk_OwnerFlag(a4)
  708.     beq.s    rf_SkipReadText
  709.  
  710.     move.l    d0,-(sp)
  711.     lea    ReadTxt(pc),a0
  712.     bsr    PrintText
  713.     move.l    (sp)+,d0
  714.  
  715. rf_SkipReadText
  716.  
  717.     move.l    d0,d1
  718.     move.l    wk_FileBufferPtr(a4),d2
  719.     move.l    wk_FileSize(a4),d3
  720.     bsr    ReadFileData
  721.  
  722.     cmp.b    #OFF,wk_OwnerFlag(a4)
  723.     beq.s    rf_SkipCloseText
  724.  
  725.     lea    CloseTxt(pc),a0
  726.     bsr    PrintText
  727.  
  728. rf_SkipCloseText
  729.  
  730.     move.l    wk_FileHandle(a4),d1
  731.     bsr    CloseFile
  732.  
  733.     move.l    wk_FileBufferPtr(a4),d1
  734.     move.l    wk_FileSize(a4),d3
  735.     move.l    d1,a0
  736.     subq.l    #8,d3
  737.     clr.b    0(a0,d3.l)
  738.     clr.b    1(a0,d3.l)
  739.     clr.b    2(a0,d3.l)
  740.     clr.b    3(a0,d3.l)
  741.  
  742.     jsr    _LVOForbid(a6)
  743.  
  744.     move.l    wk_FileBufferPtr(a4),d1
  745.     move.l    wk_FileSize(a4),d2
  746.     moveq    #0,d0
  747.     rts
  748.  
  749. rf_FileLocationError
  750.     lea    FileLockErrTxt(pc),a0
  751.     bsr    PrintText
  752.     bsr    WaitMouse
  753.     moveq    #-1,d0
  754.     rts
  755.     
  756. rf_ExamineError
  757.     lea    FileExamErrTxt(pc),a0
  758.     bsr    PrintText
  759.     move.l    wk_LockHandle(a4),d1
  760.     bsr    UnLockFile
  761.     bsr    WaitMouse
  762.     moveq    #-2,d0
  763.     rts
  764.  
  765. rf_NoFileMemoryError
  766.     lea    NoFileMemErrTxt(pc),a0
  767.     bsr    PrintText
  768.     bsr    WaitMouse
  769.     moveq    #-3,d0
  770.     rts
  771.     
  772. rf_FileOpenError
  773.     lea    FileOpenErrTxt(pc),a0
  774.     bsr    PrintText
  775.     move.l    wk_FileSize(a4),d0
  776.     move.l    wk_FileBufferPtr(a4),a1
  777.     bsr    FreeMem
  778.     bsr    WaitMouse
  779.     moveq    #-4,d0
  780.     rts
  781.  
  782.  
  783. ;    ======================================================================
  784. ;    FUNCTION: LockFile
  785. ;    USE:      Get a lock on a file
  786. ;    PARAMS:      d1 - Address of filename 
  787. ;          d2 - Lock type
  788. ;    RESULT:      d0 - Error status
  789.  
  790. LockFile:
  791.     move.l    a6,-(sp)
  792.     moveq    #0,d0
  793.     move.l    wk_DosBase(a4),a6
  794.     jsr    _LVOLock(a6)
  795.     move.l    (sp)+,a6
  796.     rts
  797.  
  798.  
  799. ;    ======================================================================
  800. ;    FUNCTION: UnLockFile
  801. ;    USE:      Remove a lock on a file
  802. ;    PARAMS:      d1 - FileLock
  803. ;    RESULT:      None
  804.  
  805. UnLockFile:
  806.     move.l    a6,-(sp)
  807.     move.l    wk_DosBase(a4),a6
  808.     jsr    _LVOUnLock(a6)
  809.     move.l    (sp)+,a6
  810.     rts
  811.  
  812. ;    ======================================================================
  813. ;    FUNCTION: ExamineFile
  814. ;    USE:      Find out the info on the file e.g size...
  815. ;    PARAMS:      d1 - LockHandle
  816. ;          d2 - File info block buffer address
  817. ;    RESULT:      d0 - Error status
  818.  
  819. ExamineFile:
  820.     move.l    a6,-(sp)
  821.     moveq    #0,d0
  822.     move.l    wk_DosBase(a4),a6
  823.     jsr    _LVOExamine(a6)
  824.     move.l    (sp)+,a6
  825.     rts
  826.  
  827.  
  828. ;    ======================================================================
  829. ;    FUNCTION: AllocMem
  830. ;    USE:      Allocate a block of memory
  831. ;    PARAMS:      d0 - Size in bytes
  832. ;          d1 - Memory type
  833. ;    RESULT:      d0 - Error status
  834.  
  835. AllocMem:
  836.     jmp    _LVOAllocMem(a6)
  837.  
  838. ;    ======================================================================
  839. ;    FUNCTION: FreeMem
  840. ;    USE:      Free a block of memory
  841. ;    PARAMS:      d0 - Size in bytes
  842. ;          a1 - Memory block address
  843. ;    RESULT:      None
  844.  
  845. FreeMem:
  846.     jmp    _LVOFreeMem(a6)
  847.  
  848.  
  849. ;    ======================================================================
  850. ;    FUNCTION: OpenFile
  851. ;    USE:      To get a handle on a file
  852. ;    PARAMS:      d1 - Address of the filename
  853. ;          d2 - Access mode
  854. ;    RESULT:      d0 - FileHandle (or NULL if error)
  855.  
  856.  
  857. OpenFile:
  858.     move.l    a6,-(sp)
  859.     move.l    wk_DosBase(a4),a6
  860.     jsr    _LVOOpen(a6)
  861.     move.l    (sp)+,a6
  862.     rts
  863.  
  864.  
  865. ;    ======================================================================
  866. ;    FUNCTION: ReadFileData
  867. ;    USE:      To read a file into a buffer
  868. ;    PARAMS:      d1 - FileHandle
  869. ;          d2 - Address of buffer
  870. ;          d3 - Length of file
  871. ;    RESULT:      None
  872.  
  873. ReadFileData:
  874.     move.l    a6,-(sp)
  875.     move.l    wk_DosBase(a4),a6
  876.     jsr    _LVORead(a6)
  877.     move.l    (sp)+,a6
  878.     rts
  879.  
  880.  
  881. ;    ======================================================================
  882. ;    FUNCTION: CloseFile
  883. ;    USE:      To remove a handle on a file
  884. ;    PARAMS:      d1 - FileHandle
  885. ;    RESULT:      None
  886.  
  887.  
  888. CloseFile:
  889.     move.l    a6,-(sp)
  890.     move.l    wk_DosBase(a4),a6
  891.     jsr    _LVOClose(a6)
  892.     move.l    (sp)+,a6
  893.     rts
  894.  
  895.  
  896. ;    ======================================================================
  897. ;    FUNCTION: WaitTime
  898. ;    USE:      To wait a specified amount of time
  899. ;    PARAMS:      d1 - Number of ticks???
  900. ;    RESULT:      None
  901.  
  902.  
  903. WaitTime:
  904.     move.l    a6,-(sp)
  905.     move.l    wk_DosBase(a4),a6
  906.     jsr    _LVODelay(a6)
  907.     move.l    (sp)+,a6
  908.     rts
  909.  
  910.  
  911. ;    ======================================================================
  912. ;    FUNCTION: ReadPage
  913. ;    USE:      To read in a specific page
  914. ;    PARAMS:      a0 - Address of the file name
  915. ;          a1 - Address of the page title
  916. ;    RESULT:      d0 - Error status
  917.  
  918.  
  919. ReadPage
  920.     move.l    a1,-(sp) ; Page title      (in this routine....       )
  921.     move.l    a0,-(sp) ; Save file name
  922.  
  923.     bsr    ClearText        ; Clear the screen we dont
  924.  
  925.     cmp.b    #OFF,wk_OwnerFlag(a4)
  926.     beq.s    rp_SkipReadText
  927.  
  928.     lea    ReadingFile1Txt(pc),a0    ; wanna wrap back to the top...
  929.     bsr    PrintText
  930.  
  931.     move.l    (sp)+,a0    ; Get filenames address
  932.     move.l    a0,-(sp)    ; Save again for posterity
  933.     bsr    PrintText
  934.     lea    ReadingFile2Txt(pc),a0
  935.     bsr    PrintText
  936.  
  937. rp_SkipReadText
  938.     move.l    (sp)+,d0    ; Get filenames address
  939.  
  940.     move.l    wk_FileSize(a4),wk_OldFileSize(a4)
  941.     move.l    wk_FileBufferPtr(a4),wk_OldFileBufferPtr(a4)
  942.  
  943.     bsr    ReadFile
  944.     tst.l    d0
  945.     bne.s    rp_Continue
  946.     move.l    d1,wk_PageBufferPtr(a4)
  947.     move.l    d2,wk_PageSize(a4)
  948.  
  949.     move.l    wk_OldFileSize(a4),d0
  950.     tst.l    d0
  951.     beq.s    rp_NoMemToFree
  952.  
  953.     move.l    wk_OldFileBufferPtr(a4),a1
  954.     bsr    FreeMem
  955.  
  956. rp_NoMemToFree
  957.     moveq    #0,d0
  958.     move.l    d0,wk_FileSize(a4)    ; Clear these so they arent
  959.     move.l    d0,wk_FileBufferPtr(a4)    ; freed more than once  ;(
  960.     move.l    d0,wk_OldFileSize(a4)    ; ;( = Sad face
  961.     move.l    d0,wk_OldFileBufferPtr(a4) 
  962.  
  963.     cmp.b    #OFF,wk_OwnerFlag(a4)
  964.     beq.s    rp_SkipReadyText
  965.  
  966.     lea    ReadyTxt(pc),a0        ; Notify user that disk functions
  967.     bsr    PrintText        ; are finished
  968.  
  969. rp_SkipReadyText
  970.  
  971.     lea    BlankTitle(pc),a0
  972.     bsr    PrintString
  973.  
  974.     move.l    (sp)+,a0        ; Get Title address
  975.     moveq    #07,d1            ; Print the page title
  976.     moveq    #CursorYMaximum+2,d2    ; same place...
  977.     bsr    ps_PrintNextChar    ; Jump into printstring
  978.  
  979.     bsr.s    DecrunchPage
  980.     tst.l    d0
  981.     bne.s    DecrunchError        ; Not crunched ? No Mem
  982.  
  983.     bsr    CountLines        ; Count the lines in the article
  984.     bsr    FindLines
  985.     
  986.     bra    RefreshPage        ; Print the new display
  987.  
  988. rp_Continue
  989.     move.l    wk_OldFileSize(a4),wk_FileSize(a4)
  990.     move.l    wk_OldFileBufferPtr(a4),wk_FileBufferPtr(a4)
  991.     bra    RefreshPage
  992.  
  993. DecrunchError
  994.     bra    ck_RefreshIndex
  995.  
  996. ;    ======================================================================
  997.  
  998. DecrunchPage
  999.     move.l    wk_PageBufferPtr(a4),a0
  1000.     cmp.l    #'FLT0',(a0)
  1001.     bne    dp_NotCrunchedError
  1002.  
  1003.     move.l    4(a0),d0    ; Crunched data length
  1004.     
  1005.     move.l    wk_PageBufferPtr(a4),a1
  1006.     addq.l    #8,a1
  1007.     add.l    d0,a1
  1008.     move.l    -4(a1),d6    ; Decrunched data length
  1009.     move.l    a1,-(sp)
  1010.  
  1011.     ; Alloc Dest mem
  1012.     move.l    d6,d0
  1013.     move.l    d6,wk_DecrunchedFileSize(a4)
  1014.     move.l    #(MEMF_CLEAR!MEMF_PUBLIC),d1
  1015.     bsr    AllocMem
  1016.     tst.l    d0
  1017.     beq.s    dp_AllocError
  1018.     move.l    d0,wk_DecrunchedFilePtr(a4)
  1019.  
  1020.     move.l    (sp)+,a0            ; Source address
  1021.     move.l    wk_DecrunchedFilePtr(a4),a1    ; Dest address
  1022.     bsr    DecrunchFile
  1023.  
  1024.     move.l    wk_PageSize(a4),d0
  1025.     move.l    wk_PageBufferPtr(a4),a1
  1026.     bsr    FreeMem
  1027.  
  1028.     move.l    wk_DecrunchedFilePtr(a4),wk_PageBufferPtr(a4) ; Save address
  1029.     move.l    wk_DecrunchedFilePtr(a4),wk_PageOffsetPtr(a4) ; Start offset
  1030.     move.l    wk_DecrunchedFileSize(a4),wk_PageSize(a4)     ; Save length
  1031.     clr.l    wk_CurrentLineNum(a4)
  1032.     moveq    #0,d0
  1033.     rts
  1034.  
  1035. dp_NotCrunchedError
  1036.     move.w    vhposr(a5),color00(a5)
  1037.     moveq    #-1,d0
  1038.     rts
  1039.  
  1040. dp_AllocError
  1041.     move.l    (sp)+,a0    ; Unload off stack
  1042.     moveq    #-2,d0
  1043.     rts
  1044.  
  1045. ;    ======================================================================
  1046.  
  1047. DecrunchIndex
  1048.     move.l    wk_IndexBufferPtr(a4),a0
  1049.     cmp.l    #'FLT0',(a0)
  1050.     bne    di_NotCrunchedError
  1051.  
  1052.     move.l    4(a0),d0    ; Crunched data length
  1053.     
  1054.     move.l    wk_IndexBufferPtr(a4),a1
  1055.     addq.l    #8,a1
  1056.     add.l    d0,a1
  1057.     move.l    -4(a1),d6    ; Decrunched data length
  1058.     move.l    a1,-(sp)
  1059.  
  1060.     ; Alloc Dest mem
  1061.     move.l    d6,d0
  1062.     move.l    d6,wk_DecrunchedFileSize(a4)
  1063.     move.l    #(MEMF_CLEAR!MEMF_PUBLIC),d1
  1064.     bsr    AllocMem
  1065.     tst.l    d0
  1066.     beq.s    di_AllocError
  1067.     move.l    d0,wk_DecrunchedFilePtr(a4)
  1068.  
  1069.     move.l    (sp)+,a0            ; Source address
  1070.     move.l    wk_DecrunchedFilePtr(a4),a1    ; Dest address
  1071.     bsr    DecrunchFile
  1072.  
  1073.     move.l    wk_PageSize(a4),d0
  1074.     move.l    wk_PageBufferPtr(a4),a1
  1075.     bsr    FreeMem
  1076.  
  1077.     move.l    wk_DecrunchedFilePtr(a4),wk_IndexBufferPtr(a4)    ; Save address
  1078.     move.l    wk_DecrunchedFilePtr(a4),wk_PageOffsetPtr(a4)    ; Start offset
  1079.     move.l    wk_DecrunchedFileSize(a4),wk_IndexSize(a4)    ; Save length
  1080.     clr.l    wk_CurrentLineNum(a4)
  1081.     moveq    #0,d0
  1082.     rts
  1083.  
  1084. di_NotCrunchedError
  1085.     moveq    #-1,d0
  1086.     rts
  1087.  
  1088. di_AllocError
  1089.     move.l    (sp)+,a0    ; Unload off stack
  1090.     moveq    #-2,d0
  1091.     rts
  1092.  
  1093. ;    ======================================================================
  1094. ;    ****    ROUTINE: DecrunchFile            ****
  1095. ;    ****    AUTHOR:     Unknown            ****
  1096. ;    ****    PARAMS:     A0 - Source file buffer  ****
  1097. ;    ****         A1 - Dest file buffer      ****
  1098.  
  1099.  
  1100. DecrunchFile
  1101.     move.l    -(a0),a2
  1102.     add.l    a1,a2
  1103.     move.l    -(a0),d5
  1104.     move.l    -(a0),d0
  1105.     eor.l    d0,d5
  1106. Decrunch01
  1107.     lsr.l    #1,d0
  1108.     bne.s    Decrunch02
  1109.     bsr    Decrunch16
  1110. Decrunch02
  1111.     bcs    Decrunch9
  1112.     moveq    #8,d1
  1113.     moveq    #1,d3
  1114.     lsr.l    #1,d0
  1115.     bne.s    Decrunch03
  1116.     bsr    Decrunch16
  1117. Decrunch03
  1118.     bcs    Decrunch11
  1119.     moveq    #3,d1
  1120.     clr.w    d4
  1121. Decrunch04
  1122.     bsr    Decrunch17
  1123.     move.w    d2,d3
  1124.     add.w    d4,d3
  1125. Decrunch05
  1126.     moveq    #7,d1
  1127. Decrunch06
  1128.     lsr.l    #1,d0
  1129.     bne.s    Decrunch07
  1130.     bsr    Decrunch16
  1131. Decrunch07
  1132.     roxl.l    #1,d2
  1133.     dbra    d1,Decrunch06
  1134.  
  1135.     move.b    d2,-(a2)
  1136.     dbra    d3,Decrunch05
  1137.  
  1138.     bra    Decrunch13
  1139.  
  1140. Decrunch08
  1141.     moveq    #8,d1
  1142.     moveq    #8,d4
  1143.     bra.s    Decrunch04
  1144.  
  1145. Decrunch9
  1146.     moveq    #2,d1
  1147.     bsr    Decrunch17
  1148.     cmp.b    #2,d2
  1149.     blt.s    Decrunch10
  1150.     cmp.b    #3,d2
  1151.     beq.s    Decrunch08
  1152.     moveq    #8,d1
  1153.     bsr    Decrunch17
  1154.     move.w    d2,d3
  1155.     move.w    #12,d1
  1156.     bra    Decrunch11
  1157.  
  1158. Decrunch10
  1159.     move.w    #9,d1
  1160.     add.w    d2,d1
  1161.     addq.w    #2,d2
  1162.     move.w    d2,d3
  1163. Decrunch11
  1164.     bsr    Decrunch17
  1165. Decrunch12
  1166.     subq.w    #1,a2
  1167.     move.b    0(a2,d2.w),(a2)
  1168. ;    move.w    a2,_custom+color0    ; Flash
  1169.     dbra    d3,Decrunch12
  1170.  
  1171. Decrunch13
  1172.     cmp.l    a2,a1
  1173.     blt    Decrunch01
  1174.     tst.l    d5
  1175.     bne.s    Decrunch14
  1176.     rts
  1177.  
  1178. Decrunch14
  1179.     move.w    #$FFFF,d0
  1180. Decrunch15
  1181.     move.w    d0,_custom+color0
  1182.     subq.l    #1,d0
  1183.     bne.s    Decrunch15
  1184.     rts
  1185.  
  1186. Decrunch16
  1187.     move.l    -(a0),d0
  1188.     eor.l    d0,d5
  1189.     move    #$10,CCR
  1190.     roxr.l    #1,d0
  1191.     rts
  1192.  
  1193. Decrunch17
  1194.     subq.w    #1,d1
  1195.     clr.w    d2
  1196. Decrunch18
  1197.     lsr.l    #1,d0
  1198.     bne.s    Decrunch19
  1199.     move.l    -(a0),d0
  1200.     eor.l    d0,d5
  1201.     move    #$10,CCR
  1202.     roxr.l    #1,d0
  1203. Decrunch19
  1204.     roxl.l    #1,d2
  1205.     dbra    d1,Decrunch18
  1206.  
  1207.     rts
  1208.  
  1209. ;    ======================================================================
  1210. ;    FUNCTION: CountLines
  1211. ;    USE:      To get the number of lines in the article..
  1212. ;    PARAMS:      None
  1213. ;    RESULT:      None
  1214.  
  1215. CountLines:
  1216.     move.l    wk_PageBufferPtr(a4),a0
  1217.     moveq    #0,d0        ; Loop counter
  1218.     moveq    #0,d1        ; Character buffer
  1219.     moveq    #1,d2        ; Line counter
  1220.  
  1221. CountALine:
  1222.     moveq    #BytesPerLine-1,d0
  1223. cal_Loop:
  1224.     move.b    (a0),d1        ; Start of current line
  1225.     cmp.b    #10,d1        ; Is char == Newline/CR
  1226.     beq.s    cal_FoundEOL
  1227.  
  1228.     tst.b    d1        ; Is char == NULL
  1229.     beq.s    cl_FoundEOF
  1230.  
  1231.     lea    1(a0),a0    ; Increment address
  1232.     dbra    d0,cal_Loop    ; Check next byte
  1233.  
  1234.     bra.s    call_FoundEOL
  1235.  
  1236. cal_FoundEOL:
  1237.     lea    1(a0),a0    ; Increment address
  1238.  
  1239. call_FoundEOL:
  1240.     addq.l    #1,d2        ; Increment Linecount
  1241.     bra.s    CountALine    ; Get Next line.....
  1242.  
  1243. cl_FoundEOF:
  1244.     move.l    d2,wk_PageNumLines(a4)
  1245.     rts
  1246.  
  1247. ;    ======================================================================
  1248. ;    FUNCTION: FindLines
  1249. ;    USE:      To get the offsets of all the lines in the article..
  1250. ;    PARAMS:      None
  1251. ;    RESULT:      None
  1252.  
  1253. FindLines:
  1254.     tst.l    wk_PageTableSize(a4)
  1255.     beq.s    fl_NoPreviousTable
  1256.  
  1257.     move.l    wk_PageTableSize(a4),d0
  1258.     move.l    wk_PageTablePtr(a4),a1
  1259.     jsr    _LVOFreeMem(a6)        ; Free table of ptrs to newlines.
  1260.  
  1261. fl_NoPreviousTable:
  1262.     move.l    wk_PageNumLines(a4),d0
  1263.     lsl.l    #2,d0        ; NumLines * 4
  1264.     add.l    #200,d0        ; Xtra space..
  1265.     move.l    d0,wk_PageTableSize(a4)
  1266.  
  1267.     move.l    #(MEMF_CLEAR!MEMF_PUBLIC),d1
  1268.     bsr    AllocMem
  1269.  
  1270.     ;    Assume there's enuff mem...
  1271.  
  1272.     move.l    d0,wk_PageTablePtr(a4)
  1273.  
  1274.     move.l    wk_PageBufferPtr(a4),a0
  1275.     move.l    d0,a1        ; Page Table
  1276.     moveq    #0,d0        ; Loop counter
  1277.     moveq    #0,d1        ; Character buffer
  1278.     move.l    a0,(a1)
  1279.     addq.l    #4,a1        ; Get start of first line
  1280.     
  1281. FindALine:
  1282.     moveq    #BytesPerLine-1,d0
  1283. fal_Loop:
  1284.     move.b    (a0),d1        ; Start of current line
  1285.     cmp.b    #10,d1        ; Is char == Newline/CR
  1286.     beq.s    fal_FoundEOL
  1287.  
  1288.     tst.b    d1        ; Is char == NULL
  1289.     beq.s    fl_FoundEOF
  1290.  
  1291.     lea    1(a0),a0    ; Increment address
  1292.     dbra    d0,fal_Loop    ; Check next byte
  1293.  
  1294.     bra.s    fall_FoundEOL
  1295.  
  1296. fal_FoundEOL:
  1297.     lea    1(a0),a0    ; Increment address
  1298.  
  1299. fall_FoundEOL:
  1300.     move.l    a0,(a1)        ; Save address of the line.
  1301.     addq.l    #4,a1        ; Next offset
  1302.     bra.s    FindALine    ; Get Next line.....
  1303.  
  1304. fl_FoundEOF:
  1305.     rts
  1306.  
  1307. ;    ======================================================================
  1308. ;    FUNCTION: CloseDown
  1309. ;    USE:      Restore copper, free allocated memory
  1310. ;    PARAMS:      None
  1311. ;    RESULT:      None
  1312.  
  1313.  
  1314. CloseDown
  1315.     bsr    RemoveInterrupt        ; Kill our interrupt.
  1316.  
  1317.     move.w    wk_DMAConSave(a4),d0
  1318.     or.w    #%1000000000000000,d0    ; Set 'Set' bit of register.
  1319.     move.w    d0,dmacon(a5)        ; Restore DMA Control register.
  1320.  
  1321.     move.w    wk_IntenaSave(a4),d0
  1322.     or.w    #%1100000000000000,d0
  1323.     move.w    d0,intena(a5)        ; Restore Interrrupt enable register.
  1324.  
  1325.     lea    GfxName(pc),a1
  1326.     jsr    _LVOOldOpenLibrary(a6)
  1327.     move.l    d0,a1            ; Open graphics library.
  1328.     tst.l    d0
  1329.     beq    NoGfxLib
  1330.  
  1331.     move.l    gb_copinit(a1),cop1lch(a5)
  1332.     clr.w    copjmp1(a5)        ; Restore old copperlist.
  1333.  
  1334.     jsr    _LVOCloseLibrary(a6)    ; Close graphics library.
  1335.  
  1336. FreeLineTable
  1337.     tst.l    wk_PageTableSize(a4)
  1338.     beq.s    Plane2Error        ; Check table is not free..
  1339.  
  1340.     move.l    wk_PageTableSize(a4),d0
  1341.     move.l    wk_PageTablePtr(a4),a1
  1342.     jsr    _LVOFreeMem(a6)        ; Free table of ptrs to newlines.
  1343.     
  1344. Plane2Error
  1345.     move.l    #NumberOfPlanes*((ScreenWidth*ScreenHeight)/8),d0
  1346.     move.l    wk_Bitplane1(a4),a1
  1347.     jsr    _LVOFreeMem(a6)        ; Free bitplanes/display memory.
  1348.  
  1349.     tst.l    wk_DoubleBuffer(a4)
  1350.     beq.s    FreeWorkMem        ; Check table is not free..
  1351.  
  1352.     move.l    #((ScreenWidth*ScreenHeight)/8),d0
  1353.     move.l    wk_DoubleBuffer(a4),a1
  1354.     jsr    _LVOFreeMem(a6)        ; Free Double Buffer.
  1355.  
  1356. FreeWorkMem
  1357.     move.l    #Workspace_SizeOf,d0
  1358.     move.l    a4,a1
  1359.     jmp    _LVOFreeMem(a6)    
  1360.  
  1361. CloseDos
  1362.     move.l    wk_DosBase(a4),a1
  1363.     jmp    _LVOCloseLibrary(a6)
  1364.  
  1365. CloseIntui
  1366.     move.l    wk_IntuiBase(a4),a1
  1367.     move.l    wk_OldAutoRequest(a4),_LVOAutoRequest+2(a1)
  1368.     jmp    _LVOCloseLibrary(a6)
  1369.  
  1370. NoGfxLib
  1371.     move.l    #$0E03,d0
  1372. ngl_Loop
  1373.     add.w    #$0100,d0    
  1374.     move.w    d0,color00(a5)
  1375.     bra.s    ngl_Loop
  1376.  
  1377. ;    ======================================================================
  1378. ;    FUNCTION: FetchPage
  1379. ;    USE:      Fetches the wanted page
  1380. ;    PARAMS:      a0 - Address of buffer
  1381. ;    RESULT:      None
  1382.  
  1383.  
  1384. FetchPage:
  1385.     moveq    #0,d0
  1386.     move.l    wk_IndexBufferPtr(a4),a0    
  1387.     cmp.w    #'00',wk_CurrentNumber(a4)
  1388.     beq    ck_RefreshIndex
  1389.  
  1390. si_FindPageDataLine
  1391.     moveq    #0,d0
  1392.     move.w    wk_CurrentNumber(a4),d1
  1393. si_FindPageNumber
  1394.     move.b    (a0),d0
  1395.     addq.l    #1,a0
  1396.     cmp.b    #'#',d0            ; Have we found a page?
  1397.     bne.s    si_ContNumSearch    ; If not skip
  1398.  
  1399.     move.l    a0,-(sp)        ; Routine to avoid odd addresses in A0
  1400.     move.b    (a0)+,d2        ; Get first number
  1401.     rol.w    #8,d2            ; Put in right place
  1402.     move.b    (a0)+,d2        ; Put second number in right place
  1403.     move.l    (sp)+,a0        ; Restore old A0
  1404.  
  1405.     cmp.w    d2,d1            ; Is it CurrentNumber page?
  1406.     beq.s    si_FindPageName        ; If so branch to next routine
  1407. si_ContNumSearch
  1408.     tst.b    d0            ; Have we reached the end of the file
  1409.     beq    si_NoSuchPage
  1410.     bra.s    si_FindPageNumber    ; Check next byte
  1411.  
  1412. si_FindPageName
  1413.     move.l    a0,-(sp)
  1414.     bsr    ClearText
  1415.     move.l    (sp)+,a0
  1416.  
  1417. si_FindNameLoop
  1418.     move.b    (a0),d0
  1419.     addq.l    #1,a0
  1420.     cmp.b    #'"',d0            ; Is it the start of a filename?
  1421.     beq    si_FoundPageName
  1422.     bra.s    si_FindNameLoop
  1423.  
  1424. si_FoundPageName
  1425.     lea    wk_PageNameBuffer(a4),a1
  1426. si_FindEOP
  1427.     move.b    (a0),d0
  1428.     addq.l    #1,a0
  1429.     cmp.b    #TAB,d0        ; Another stupid TAB???
  1430.     beq.s    si_FindEOP
  1431.     cmp.b    #'"',d0        ; Is it the end of the name?
  1432.     beq    si_FoundEOPName
  1433.     tst.b    d0        ; Have we reached the EOF
  1434.     beq.s    si_NoSuchPage
  1435.     move.b    d0,(a1)+    ; Must be a valid value then??
  1436.     bra.s    si_FindEOP
  1437.  
  1438. si_FoundEOPName
  1439.     clr.b    (a1)+        ; EOS = NULL, so PrintString can pick it up
  1440.  
  1441.     move.w    wk_CurrentNumber(a4),d0
  1442.     lea    TextNumberBuffer(pc),a0
  1443.     move.w    d0,(a0)
  1444.  
  1445.     lea    TextName(pc),a0
  1446.     lea    wk_PageNameBuffer(a4),a1
  1447.     bra    ReadPage
  1448.  
  1449. si_NoSuchPage
  1450.     move.l    #$FF,d0
  1451. np_FlashLoop
  1452.     move.w    #$0FFF,color00(a5)
  1453.     dbra    d0,np_FlashLoop
  1454.     rts
  1455.  
  1456. NotIndexFile
  1457.     bsr    ClearText
  1458.     lea    NotIndexFileErrCTxt(pc),a0
  1459.     bsr    PrintString
  1460.     bsr    WaitMouse
  1461.     bra    ni_Continue
  1462.  
  1463. ;    ======================================================================
  1464. ****       Start of the Interrupt Code         ****
  1465.  
  1466.  
  1467. InstallInterrupt:
  1468.     lea    wk_IrqStruct(a4),a1
  1469.     move.b    #NT_INTERRUPT,8(a1)    ; Node type
  1470.     move.b    #127,9(a1)        ; Interrupt priority
  1471.     lea    FLTInterrupt(pc),a0    ; Actual interrupt code address
  1472.     move.l    a0,18(a1)
  1473.     moveq    #5,d0            ; Interrupt type = ??
  1474.     jsr    _LVOAddIntServer(a6)    ; Start interrupt
  1475.     rts
  1476.  
  1477. RemoveInterrupt:
  1478.     lea    wk_IrqStruct(a4),a1
  1479.     moveq    #5,d0            ; Interrupt type = ??
  1480.     jsr    _LVORemIntServer(a6)    ; Kill interrupt
  1481.     rts
  1482.  
  1483. FLTInterrupt:
  1484.     movem.l    d0-d7/a0-a6,-(sp)
  1485.  
  1486.     move.l    4.w,a6
  1487.     lea    $dff000,a5
  1488.     move.l    MemAddress(pc),a4
  1489.  
  1490.     cmp.b    #OFF,wk_OwnerFlag(a4)
  1491.     beq.s    ir_SkipPrint
  1492.     addq.w    #1,wk_PrintCounter(a4)
  1493.     cmp.w    #10,wk_PrintCounter(a4)
  1494.     ble.s    ir_SkipPrint
  1495.     clr.w    wk_PrintCounter(a4)
  1496.     bsr    PrintCoords
  1497.  
  1498. ir_SkipPrint
  1499.     bsr    GetKey            ; Collect keypresses
  1500.     bsr    PrintPageNumber        ; Print page number...
  1501.  
  1502.     cmp.b    #OFF,wk_OwnerFlag(a4)
  1503.     beq.s    ir_SkipMouseStuff
  1504.     bsr    GetMouseCoords        ; Read sprite movement
  1505.     bsr    CheckCoords        ; Check screen boundaries
  1506.     bsr    MoveMouse        ; Move mouse now
  1507.  
  1508. ir_SkipMouseStuff
  1509.     movem.l    (sp)+,d0-d7/a0-a6
  1510.     rts
  1511.  
  1512.  
  1513. ;    *****            End of the Interrupt Code         *****
  1514.  
  1515. ;    ======================================================================
  1516. ;    FUNCTION: WaitMouse
  1517. ;    USE:      Waits for left mouse button
  1518. ;    PARAMS:      None
  1519. ;    RESULT:      None
  1520.  
  1521.  
  1522. WaitMouse
  1523.     btst    #6,ciaapra
  1524.     bne.s    WaitMouse
  1525.     rts
  1526.  
  1527. ;    ======================================================================
  1528. ;    FUNCTION: WaitBlitter
  1529. ;    USE:      Waits for blitter to finish current operation
  1530. ;    PARAMS:      None
  1531. ;    RESULT:      None
  1532.  
  1533.  
  1534. WaitBlitter
  1535.     btst    #14,dmaconr(a5)        ; For safeties sake
  1536.     btst    #14,dmaconr(a5)
  1537.     bne.s    WaitBlitter
  1538.     rts
  1539.  
  1540.  
  1541. ;    ======================================================================
  1542. ;    FUNCTION: WaitKeyRelease
  1543. ;    USE:      Waits for the key held down to be released
  1544. ;    PARAMS:      d0 = Old key code
  1545. ;    RESULT:      None
  1546.  
  1547. WaitKeyRelease
  1548.     or.b    #%10000000,d0
  1549. wkr_WaitLoop
  1550.     move.w    wk_KeyBuffer(a4),d1
  1551.     and.w    #%00000000000000001111111111111111,d1
  1552.     cmp.b    d0,d1
  1553.     bne.s    wkr_WaitLoop
  1554.  
  1555.     rts
  1556.  
  1557.  
  1558. ;    ======================================================================
  1559. ;    FUNCTION: RefreshPage
  1560. ;    USE:      Refreshs the current page
  1561. ;    PARAMS:      None
  1562. ;    RESULT:      None
  1563.  
  1564.  
  1565. RefreshPage
  1566.     move.l    wk_PageOffsetPtr(a4),a0
  1567.     bra    PrintText
  1568.  
  1569.  
  1570. ;    ======================================================================
  1571. ;    FUNCTION: ClearText
  1572. ;    USE:      Clears the text bitplane
  1573. ;    PARAMS:      None
  1574. ;    RESULT:      None
  1575.  
  1576.  
  1577. OnePlaneOnly    equ    1
  1578.  
  1579. ClearText
  1580.     move.w    #0,wk_CursXCoord(a4)
  1581.     move.w    #CursorYMinimum,wk_CursYCoord(a4)
  1582.  
  1583.     moveq    #0,d0
  1584.     move.l    wk_Bitplane1(a4),a0
  1585.     lea    CursorYMinimum*8*BytesPerLine(a0),a0
  1586.  
  1587.     move.l    #((CursorYMaximum-CursorYMinimum+1)*8)*OnePlaneOnly*64+BytesPerLine/2,d3
  1588.  
  1589. ct_Clear1MoreLine
  1590.  
  1591.     bsr    WaitBlitter        ; Wait till blitter has finished
  1592. ctl_WaitVPos
  1593.     move.l    vposr(a5),d1
  1594.     and.l    #$1FF00,d1
  1595.     cmp.l    #$13700,d1
  1596.     bne.s    ctl_WaitVPos
  1597.  
  1598.     move.l    a0,bltdpth(a5)        ; Dest screen address.
  1599.     clr.w    bltdmod(a5)
  1600.     move.l    #$ffffffff,bltafwm(a5)
  1601.     move.l    #$01000000,bltcon0(a5)    ; Only dest channel so nothing is
  1602.     move    d3,bltsize(a5)        ; is copied, hence clearing....
  1603.     bra    WaitBlitter        ; Wait till blitter has finished
  1604.  
  1605.  
  1606. ;    ======================================================================
  1607. ;    FUNCTION: ClearDoubleBuffer
  1608. ;    USE:      Clears the double buffer bitplane
  1609. ;    PARAMS:      None
  1610. ;    RESULT:      None
  1611.  
  1612. ClearDoubleBuffer
  1613.     move.w    #0,wk_CursXCoord(a4)
  1614.     move.w    #CursorYMinimum,wk_CursYCoord(a4)
  1615.  
  1616.     moveq    #0,d0
  1617.     move.l    wk_DoubleBuffer(a4),a0
  1618.     lea    CursorYMinimum*ScreenWidth(a0),a0
  1619.  
  1620.     move.l    #((CursorYMaximum-CursorYMinimum+1)*8)*OnePlaneOnly*64+BytesPerLine/2,d3
  1621.  
  1622. cdb_Clear1MoreLine
  1623.  
  1624.     bsr    WaitBlitter        ; Wait till blitter has finished
  1625. cdbl_WaitVPos
  1626.     move.l    vposr(a5),d1
  1627.     and.l    #$1FF00,d1
  1628.     cmp.l    #$13700,d1
  1629.     bne.s    cdbl_WaitVPos
  1630.  
  1631.     move.l    a0,bltdpth(a5)        ; Dest screen address.
  1632.     clr.w    bltdmod(a5)
  1633.     move.l    #$ffffffff,bltafwm(a5)
  1634.     move.l    #$01000000,bltcon0(a5)    ; Only dest channel so nothing is
  1635.     move    d3,bltsize(a5)        ; is copied, hence clearing....
  1636.     bra    WaitBlitter        ; Wait till blitter has finished
  1637.  
  1638.  
  1639. ;    ======================================================================
  1640. ;    FUNCTION: ScrollText
  1641. ;    USE:      Scrolls the text bitplane
  1642. ;    PARAMS:      None
  1643. ;    RESULT:      None
  1644.  
  1645. First    equ    0
  1646. Next    equ    1
  1647.  
  1648. BlitScrollUp
  1649.     bsr    ClearDoubleBuffer
  1650.  
  1651.     move.l    #CursorYMinimum*ScreenWidth,d0
  1652.     move.l    wk_Bitplane1(a4),a0
  1653.     lea    (CursorYMinimum+Next)*ScreenWidth(a0),a0
  1654.     move.l    wk_DoubleBuffer(a4),a1
  1655.     lea    (CursorYMinimum+First)*ScreenWidth(a1),a1
  1656.     bsr    ScrollText
  1657.  
  1658.     clr.w    wk_CursXCoord(a4)    ; Print the new line
  1659.     move.w    #CursorYMaximum,wk_CursYCoord(a4)
  1660.     move.l    wk_CurrentLineNum(a4),d0
  1661.     add.l    #CursorYMaximum-CursorYMinimum,d0
  1662.     lsl.l    #2,d0        ; Multiply by 4
  1663.     move.l    wk_PageTablePtr(a4),a0
  1664.     move.l    0(a0,d0.l),a0
  1665.     bsr    PrintALine
  1666.  
  1667.     bra.s    ScrollMoreText
  1668.  
  1669. BlitScrollDown
  1670.     bsr    ClearDoubleBuffer
  1671.  
  1672.     move.l    #CursorYMinimum*ScreenWidth,d0
  1673.     move.l    wk_Bitplane1(a4),a0
  1674.     lea    (CursorYMinimum+First)*ScreenWidth(a0),a0
  1675.     move.l    wk_DoubleBuffer(a4),a1
  1676.     lea    (CursorYMinimum+Next)*ScreenWidth(a1),a1
  1677.     bsr.s    ScrollText
  1678.  
  1679.     clr.w    wk_CursXCoord(a4)    ; Print the new line
  1680.     move.w    #CursorYMinimum,wk_CursYCoord(a4)
  1681.     move.l    wk_PageOffsetPtr(a4),a0
  1682.     bsr    PrintALine
  1683.  
  1684. ScrollMoreText
  1685.     move.l    #CursorYMinimum*ScreenWidth,d0
  1686.     move.l    wk_Bitplane1(a4),a1
  1687.     lea    (CursorYMinimum+First)*ScreenWidth(a1),a1
  1688.     move.l    wk_DoubleBuffer(a4),a0
  1689.     lea    (CursorYMinimum+First)*ScreenWidth(a0),a0
  1690.  
  1691.     move.l    #((CursorYMaximum-CursorYMinimum+1)*8)*OnePlaneOnly*64+BytesPerLine/2,d3
  1692.     bra.s    st_Do1MoreLine
  1693.  
  1694. ScrollText
  1695.     move.l    #((CursorYMaximum-CursorYMinimum)*8)*OnePlaneOnly*64+BytesPerLine/2,d3
  1696. st_Do1MoreLine
  1697.     bsr    WaitBlitter        ; Wait till blitter has finished
  1698.  
  1699.     move.l    a0,bltapth(a5)        ; Dest screen address.
  1700.     move.l    a1,bltdpth(a5)
  1701.     clr.w    bltamod(a5)
  1702.     clr.w    bltdmod(a5)
  1703.     move.l    #$ffffffff,bltafwm(a5)
  1704.     move.l    #$9F00000,bltcon0(a5)    ; Activate A and D channels for
  1705.     move    d3,bltsize(a5)        ; straight copy of data
  1706.     bra    WaitBlitter
  1707.  
  1708.  
  1709. ;    ======================================================================
  1710. ;    FUNCTION: CheckCoords
  1711. ;    USE:      Ensure mouse stays within sight boundaries
  1712. ;    PARAMS:      None
  1713. ;    RESULT:      None.
  1714.  
  1715.         
  1716. CheckCoords
  1717.     move.w    wk_SpriteXCoord(a4),d0
  1718.     cmp.w    #0,d0
  1719.     bge.s    SpriteXIsHighEnough
  1720.     move.w    #0,wk_SpriteXCoord(a4)
  1721. SpriteXIsHighEnough
  1722.     cmp.w    #320,d0
  1723.     ble.s    SpriteXIsLowEnough
  1724.     move.w    #320,wk_SpriteXCoord(a4)
  1725. SpriteXIsLowEnough    
  1726.     move.w    wk_SpriteYCoord(a4),d0
  1727.     cmp.w    #0,d0
  1728.     bge.s    SpriteYIsHighEnough
  1729.     move.w    #0,wk_SpriteYCoord(a4)
  1730. SpriteYIsHighEnough
  1731.     cmp.w    #256,d0
  1732.     ble.s    SpriteYIsLowEnough
  1733.     move.w    #256,wk_SpriteYCoord(a4)
  1734. SpriteYIsLowEnough        
  1735.     rts
  1736.  
  1737.  
  1738. ;    ======================================================================
  1739. ;    FUNCTION: GetMouseCoords
  1740. ;    USE:      To calculate mouse X and Y coords
  1741. ;    PARAMS:      None
  1742. ;    RESULT:      None
  1743.  
  1744.  
  1745. GetMouseCoords
  1746.     move.w    joy0dat(a5),d0
  1747.     move.w    wk_OldJoy0Dat(a4),d1
  1748.     move.w    d0,d2
  1749.     and.w    #%1111111100000000,d1
  1750.     and.w    #%1111111100000000,d2
  1751.     asr.w    #8,d1
  1752.     asr.w    #8,d2
  1753.     sub.w    d2,d1
  1754.     move.w    d1,d2
  1755.     bpl.s    LBC002232
  1756.     eor.w    #%1111111111111111,d2
  1757. LBC002232
  1758.     cmp.w    #128,d2
  1759.     bcs.s    LBC00223C
  1760.     move.w    #0,d1
  1761. LBC00223C
  1762.     sub.w    d1,wk_SpriteYCoord(a4)
  1763.     move.w    wk_OldJoy0Dat(a4),d1
  1764.     move.w    d0,d2
  1765.     and.w    #%0000000011111111,d1
  1766.     and.w    #%0000000011111111,d2
  1767.     sub.w    d2,d1
  1768.     move.w    d1,d2
  1769.     bpl.s    LBC002276
  1770.     eor.w    #%1111111111111111,d2
  1771. LBC002276
  1772.     cmp.w    #128,d2
  1773.     bcs.s    LBC002280
  1774.     move.w    #0,d1
  1775. LBC002280
  1776.     sub.w    d1,wk_SpriteXCoord(a4)
  1777.     move.w    d0,wk_OldJoy0Dat(a4)
  1778.     rts
  1779.  
  1780.  
  1781. ;    ======================================================================
  1782. ;    FUNCTION: MoveMouse
  1783. ;    USE:      Move the actual sprite
  1784. ;    PARAMS:      None
  1785. ;    RESULT:      None
  1786.  
  1787.  
  1788. MoveMouse
  1789.     lea    SpriteData,a0
  1790.     move.b    #1,3(a0)
  1791.     move.w    wk_SpriteXCoord(a4),d0
  1792.     add.w    #128,d0
  1793.     btst    #0,d0
  1794.     bne.s    SprWidthIsEven
  1795.     and.b    #$FE,3(a0)
  1796. SprWidthIsEven
  1797.     asr.w    #1,d0
  1798.     move.b    d0,1(a0)
  1799.     move.w    wk_SpriteYCoord(a4),d0
  1800.     add.w    #44,d0
  1801.     btst    #8,d0
  1802.     beq.s    SprStrtIsGT200
  1803.     or.b    #%0100,3(a0)
  1804. SprStrtIsGT200
  1805.     move.b    d0,0(a0)
  1806.     add.w    #13,d0
  1807.     btst    #8,d0
  1808.     beq.s    SprStopIsGT200
  1809.     or.b    #0010,3(a0)
  1810. SprStopIsGT200
  1811.     move.b    d0,2(a0)
  1812.     rts
  1813.     
  1814.  
  1815. ;    ======================================================================
  1816. ;    FUNCTION: CheckSpriteSelection
  1817. ;    USE:      To check coords for box selection
  1818. ;    PARAMS:      None
  1819. ;    RESULT:      None
  1820.  
  1821.  
  1822. CheckSpriteSelection
  1823.     btst    #06,ciaapra
  1824.     beq.s    LMouseClicked
  1825.     btst    #10,potinp(a5)
  1826.     beq.s    RMouseClicked
  1827.     rts
  1828.  
  1829. RMouseClicked
  1830.     bsr    RemoveSpecArticle
  1831.     move.b    #1,wk_QuitFlag(a4)
  1832.     rts    
  1833.  
  1834. LMouseClicked
  1835.     move.w    wk_SpriteXCoord(a4),d0
  1836.     move.w    wk_SpriteYCoord(a4),d1
  1837.  
  1838.     move.l    CurrentButtonTable(pc),a0
  1839. TestIfEnd
  1840.     cmp.l    #0,8(a0)
  1841.     beq.s    UnknownCoords
  1842.     move.w    0(a0),d2
  1843.     move.w    2(a0),d3
  1844.     move.w    4(a0),d4
  1845.     move.w    6(a0),d5
  1846.     cmp.w    d0,d2
  1847.     bgt.s    TryNextCoordSet
  1848.     cmp.w    d0,d4
  1849.     ble.s    TryNextCoordSet
  1850.     cmp.w    d1,d3
  1851.     bgt.s    TryNextCoordSet
  1852.     cmp.w    d1,d5
  1853.     ble.s    TryNextCoordSet
  1854.     move.l    8(a0),a0
  1855.     jmp    (a0)
  1856.  
  1857. TryNextCoordSet
  1858.     lea    12(a0),a0
  1859.     bra.s    TestIfEnd
  1860. UnknownCoords
  1861.     rts
  1862.     
  1863. Quit    move.b    #1,wk_QuitFlag(a4)
  1864.     rts
  1865.  
  1866.  
  1867. ;    ==================================================================
  1868. ;    FUNCTION:    CheckKeys
  1869. ;    USE:        To check for and handle keypresses
  1870. ;    INPUTS:        None
  1871. ;    OUTPUTS:    None
  1872. ;    ------------------------------------------------------------------
  1873.  
  1874. CheckKeys
  1875.     moveq    #0,d0
  1876.     move.w    wk_KeyBuffer(a4),d0    ; Do we have a keycode waiting?
  1877.     beq.s    ck_NoKeyPressed
  1878.  
  1879. ;    ------------------------------------------------------------------
  1880.  
  1881.     cmp.b    #$66,d0
  1882.     beq.s    ck_IsLAmiga
  1883.  
  1884. ;    ------------------------------------------------------------------
  1885.  
  1886.     cmp.b    #$59,d0        ; Is it F10
  1887.     beq    ck_RefreshIndex    ; If so refresh index
  1888.  
  1889. ;    ------------------------------------------------------------------
  1890.  
  1891.     cmp.b    #$58,d0        ; Is it F09
  1892.     beq.s    ck_RefreshPage    ; If so refresh page
  1893.  
  1894. ;    ------------------------------------------------------------------
  1895.  
  1896.     cmp.b    #$57,d0        ; Is it F08
  1897.     beq    ck_IsMeInfo    ; If so print my info
  1898.  
  1899. ;    ------------------------------------------------------------------
  1900.  
  1901.     cmp.b    #$45,d0        ; Is it Escape
  1902.     beq.s    ck_Quit        ; If so quit
  1903.  
  1904. ;    ------------------------------------------------------------------
  1905.  
  1906.     cmp.b    #$5F,d0        ; Help key code
  1907.     beq    ck_IsHelp
  1908.  
  1909. ;    ------------------------------------------------------------------
  1910.  
  1911.     cmp.b    #$4C,d0        ; Cursor up
  1912.     beq    ck_ScrollUpLine
  1913.  
  1914. ;    ------------------------------------------------------------------
  1915.  
  1916.     cmp.b    #$4D,d0        ; Cursor down
  1917.     beq    ck_ScrollDownLine
  1918.  
  1919. ;    ------------------------------------------------------------------
  1920.  
  1921.     cmp.b    #$4E,d0        ; Cursor right
  1922.     beq    ck_NextPage
  1923.  
  1924. ;    ------------------------------------------------------------------
  1925.  
  1926.     cmp.b    #$4F,d0        ; Cursor left
  1927.     beq    ck_PrevPage
  1928.  
  1929. ;    ------------------------------------------------------------------
  1930.  
  1931.     cmp.b    #$43,d0
  1932.     beq    ck_FetchPage
  1933.  
  1934. ;    ------------------------------------------------------------------
  1935.  
  1936.     cmp.b    #$44,d0
  1937.     beq    ck_FetchPage
  1938.  
  1939. ;    ------------------------------------------------------------------
  1940.  
  1941.     cmp.b    #$01,d0
  1942.     blt.s    ck_Cont
  1943.  
  1944. ;    ------------------------------------------------------------------
  1945.  
  1946.     cmp.b    #$0A,d0
  1947.     ble    ck_Number
  1948.  
  1949. ;    ------------------------------------------------------------------
  1950.  
  1951. ck_Cont
  1952.     cmp.b    #OFF,wk_OwnerFlag(a4)
  1953.     beq.s    ck_SkipCodePrint
  1954.  
  1955.     bsr    PrintKeyCode
  1956.  
  1957. ck_SkipCodePrint
  1958.     clr.w    wk_KeyBuffer(a4)
  1959. ck_NoKeyPressed
  1960.     rts
  1961.  
  1962.  
  1963. ;    ------------------------------------------------------------------
  1964.  
  1965. ck_Quit
  1966.     bsr    RemoveSpecArticle
  1967.     st.b    wk_QuitFlag(a4)
  1968.     bra.s    ck_Cont
  1969.  
  1970.  
  1971. ;    ------------------------------------------------------------------
  1972.  
  1973. ck_IsLAmiga
  1974.     bsr    SetupSpecArticle
  1975.     move.w    #$0FFF,color00(a5)
  1976.     bra.s    ck_Cont
  1977.  
  1978.  
  1979. ;    ------------------------------------------------------------------
  1980.  
  1981. ck_RefreshPage
  1982.     bsr    WaitKeyRelease
  1983.     bra    RemoveSpecArticle
  1984.  
  1985.  
  1986. ;    ------------------------------------------------------------------
  1987.  
  1988. ck_RefreshIndex
  1989.     bsr    WaitKeyRelease
  1990.     bsr    RemoveSpecArticle
  1991.     lea    TitleName(pc),a0
  1992.     lea    IndexTitle(pc),a1
  1993.     bra    ReadPage
  1994.  
  1995.  
  1996. ;    ------------------------------------------------------------------
  1997.  
  1998. ck_IsHelp
  1999.     bsr    WaitKeyRelease
  2000.  
  2001.     lea    HelpTxt(pc),a0
  2002.     moveq    #Help__Article,d0
  2003.     bsr    SetupSpecArticle
  2004.     lea    HelpTxt(pc),a0
  2005.     bsr    PrintNewText
  2006.     bra.s    ck_Cont
  2007.  
  2008. ;    ------------------------------------------------------------------
  2009.  
  2010. ck_ScrollUpLine:
  2011.     bsr    WaitKeyRelease
  2012.  
  2013.     move.l    wk_CurrentLineNum(a4),d0
  2014.     tst.l    d0
  2015.     ble.s    cksu_AtTopOfScreen
  2016.  
  2017.     subq.l    #1,d0        ; If not, go up...
  2018.     move.l    d0,wk_CurrentLineNum(a4)
  2019.     lsl    #2,d0        ; Multiply by 4
  2020.     move.l    wk_PageTablePtr(a4),a0
  2021.     lea    0(a0,d0.l),a0
  2022.     move.l    (a0),wk_PageOffsetPtr(a4)
  2023.  
  2024.     bsr    BlitScrollDown    ; Scroll the ^Text^ down
  2025.     
  2026. cksu_AtTopOfScreen
  2027.     
  2028.     rts
  2029.  
  2030.  
  2031. ;    ------------------------------------------------------------------
  2032.  
  2033. ck_ScrollDownLine:
  2034.     bsr    WaitKeyRelease
  2035.  
  2036.     move.l    wk_PageNumLines(a4),d0
  2037.     cmp.l    #CursorYMaximum-CursorYMinimum,d0
  2038.     ble.s    cksd_AtBottomOfScreen
  2039.  
  2040.     move.l    wk_CurrentLineNum(a4),d0
  2041.     move.l    wk_PageNumLines(a4),d1
  2042.     sub.l    #20,d1    
  2043.     cmp.l    d0,d1        ; Are we at the end of the article?
  2044.     ble.s    cksd_AtBottomOfScreen
  2045.  
  2046.     move.l    wk_CurrentLineNum(a4),d0
  2047.     addq.l    #1,d0        ; If not, go down...
  2048.     move.l    d0,wk_CurrentLineNum(a4)
  2049.     lsl.l    #2,d0        ; Multiply by 4
  2050.     move.l    wk_PageTablePtr(a4),a0
  2051.     lea    0(a0,d0.l),a0
  2052.     move.l    (a0),wk_PageOffsetPtr(a4)
  2053.  
  2054.     bsr    BlitScrollUp    ; Scroll the ^Text^ up
  2055.     
  2056. cksd_AtBottomOfScreen
  2057.     rts
  2058.  
  2059.  
  2060. ;    ------------------------------------------------------------------
  2061.  
  2062. ck_NextPage:
  2063.     bsr    WaitKeyRelease
  2064.  
  2065. ;    -----
  2066. ;    I will try and make this simpler with assignments to variables:
  2067. ;    a := Number of lines in the article.
  2068. ;    b := Current line number.
  2069. ;    c := Number of lines to display at the end of the article.
  2070. ;    d := Next page's line number.
  2071. ;    e := Length of page less one line.
  2072. ;    so (a-c) will be the maximum page line number.
  2073.  
  2074.     move.l    wk_CurrentLineNum(a4),d0        ; b
  2075.     move.l    wk_PageNumLines(a4),d1            ; a
  2076.  
  2077. ;    Here we check that there is actually enough lines to scroll..
  2078. ;    If there isn't we don't scroll.
  2079.  
  2080.     cmp.l    #CursorYMaximum-CursorYMinimum,d1    ; Is (a<=plen)
  2081.     ble.s    cksd_AtBottomOfScreen
  2082.  
  2083.     moveq    #(CursorYMaximum-CursorYMinimum)-2,d2    ; c
  2084.     moveq    #(CursorYMaximum-CursorYMinimum),d4    ; e
  2085.     move.l    d0,d3                    ; a
  2086.     add.l    d4,d3                    ; d
  2087.     sub.l    d2,d1                    ; (a-c)
  2088.  
  2089. ;    If b = (a-c) then no change/no update. This makes sure the page
  2090. ;    is not updated if it doesn't need to be.
  2091.  
  2092.     cmp.l    d1,d0                    ; Is (b=(a-c))
  2093.     beq.s    cknp_AtBottomOfArticle
  2094.  
  2095. ;    If d > (a-c) then b=(a-c), what this ensures is that the maximum
  2096. ;    page displayed will always be at the wanted position (a-c) and
  2097. ;    no more.
  2098.  
  2099.     cmp.l    d1,d3                    ; Is (d<=(a-c))
  2100.     ble.s    cknp_DownAPage
  2101.     
  2102. ;    Take the maximum line as the current line and refresh to it.
  2103.  
  2104.     move.l    d1,wk_CurrentLineNum(a4)
  2105.     move.l    d1,d0
  2106.     bra.s    cknp_JumpToLine
  2107.  
  2108. ;    Skip one whole page forward.
  2109.  
  2110. cknp_DownAPage
  2111.     move.l    wk_CurrentLineNum(a4),d0        ; Get current line number
  2112.     add.l    #(CursorYMaximum-CursorYMinimum),d0    ; Alter by set amount
  2113.     move.l    d0,wk_CurrentLineNum(a4)        ; Replace old value
  2114.  
  2115. ;    Skip d0 lines forward.
  2116.  
  2117. cknp_JumpToLine
  2118.     lsl.l    #2,d0                    ; Multiply by 4
  2119.     move.l    wk_PageTablePtr(a4),a0            ; Get table of line addresses
  2120.     move.l    0(a0,d0.l),wk_PageOffsetPtr(a4)        ; Get address of the new line
  2121.  
  2122.     bsr    RefreshPage                ; Get the Next page
  2123.     
  2124. cknp_AtBottomOfArticle
  2125.     
  2126.     rts
  2127.  
  2128. ;    ------------------------------------------------------------------
  2129.  
  2130. ck_PrevPage:
  2131.     bsr    WaitKeyRelease
  2132.  
  2133.     move.l    wk_CurrentLineNum(a4),d0
  2134.     tst.l    d0        ; Are we at the start of the article?
  2135.     ble.s    ckpp_AtTopOfArticle
  2136.     
  2137.     move.l    wk_CurrentLineNum(a4),d0
  2138.     sub.l    #CursorYMaximum-CursorYMinimum,d0
  2139.     tst.l    d0
  2140.     bgt.s    ckpp_BackWholePage
  2141.  
  2142.     moveq    #0,d0
  2143.     bra.s    ckpp_GotoStart
  2144.  
  2145. ckpp_BackWholePage
  2146.     move.l    wk_CurrentLineNum(a4),d0
  2147.     sub.l    #CursorYMaximum-CursorYMinimum,d0
  2148. ckpp_GotoStart
  2149.     move.l    d0,wk_CurrentLineNum(a4)
  2150.     lsl.l    #2,d0        ; Multiply by 4
  2151.     move.l    wk_PageTablePtr(a4),a0
  2152.     move.l    0(a0,d0.l),wk_PageOffsetPtr(a4)
  2153.  
  2154.     bsr    RefreshPage    ; Print the previous page
  2155.     
  2156. ckpp_AtTopOfArticle
  2157.     
  2158.     rts
  2159.  
  2160. ;    ------------------------------------------------------------------
  2161.  
  2162. ck_Number
  2163.     move.b    d0,-(sp)
  2164.     moveq    #0,d1
  2165.     moveq    #'0',d1        ; Specify base zero
  2166.     cmp.b    #$0A,d0        ; Is zero so don't adjust
  2167.     beq.s    ck_GotZero
  2168.  
  2169.     add.b    d0,d1        ; Calculate ascii-code of character
  2170.  
  2171. ck_GotZero
  2172.     and.w    #$00FF,d1        ; Ensure 2nd number's in right byte
  2173.     move.w    wk_CurrentNumber(a4),d0
  2174.     rol.w    #8,d0            ; Shift 1st number to left byte
  2175.     and.w    #$FF00,d0        ; Clear obselete number
  2176.     or.w    d0,d1            ; Combine both bytes
  2177.     move.w    d1,wk_CurrentNumber(a4)    ; and save... phew
  2178.  
  2179.     moveq    #0,d0
  2180.     moveq    #0,d1
  2181.     move.b    (sp)+,d0
  2182.     bsr    WaitKeyRelease
  2183.  
  2184.     bra    ck_Cont
  2185.  
  2186. ;    ------------------------------------------------------------------
  2187.  
  2188. ck_FetchPage
  2189.     bsr    WaitKeyRelease
  2190.     bsr    RemoveSpecArticle
  2191.     bsr    FetchPage
  2192.     bra    ck_Cont
  2193.  
  2194. ;    ------------------------------------------------------------------
  2195.  
  2196. ck_IsMeInfo
  2197.     bsr    WaitKeyRelease
  2198.     lea    SoltanGrisTxt(pc),a0
  2199.     moveq    #About_Article,d0
  2200.     bsr    SetupSpecArticle
  2201.     lea    SoltanGrisTxt(pc),a0
  2202.     bsr    PrintNewText
  2203.     bra    ck_Cont
  2204.  
  2205. ;    ==================================================================
  2206. ;    +           Special Article Equates:             +
  2207. ;    ------------------------------------------------------------------
  2208.  
  2209. Help__Article    equ    1
  2210. About_Article    equ    2
  2211.  
  2212.  
  2213. ;    ==================================================================
  2214. ;    FUNCTION:    SetupSpecArticle
  2215. ;    USE:        Setup & display special article.
  2216. ;    INPUTS:        a0 = Address of internal article
  2217. ;            d0 = Number of the article
  2218. ;    OUTPUTS:    None
  2219. ;    ------------------------------------------------------------------
  2220.  
  2221. SetupSpecArticle:
  2222.     tst.w    wk_SpecArticleFlag(a4)
  2223.     bne.s    ssa_ANewSpecialArticle
  2224.  
  2225.     move.w    d0,wk_SpecArticleFlag(a4)
  2226.  
  2227.     move.l    wk_CurrentLineNum(a4),wk_SpecLineNum(a4)
  2228.     move.l    wk_PageOffsetPtr(a4),wk_SpecOffset1Ptr(a4)
  2229.     move.l    wk_PageBufferPtr(a4),wk_SpecOffset2Ptr(a4)
  2230.     
  2231. ssa_ANewSpecialArticle
  2232.     move.l    a0,wk_PageOffsetPtr(a4)
  2233.     move.l    a0,wk_PageBufferPtr(a4)
  2234.     bsr    CountLines
  2235.     bsr    FindLines
  2236.     clr.l    wk_CurrentLineNum(a4)
  2237.     rts
  2238.  
  2239.  
  2240. ;    ==================================================================
  2241. ;    FUNCTION:    RemoveSpecArticle
  2242. ;    ABOUT:        Initialize display of old article.
  2243. ;    INPUTS:        None
  2244. ;    OUTPUTS:    None
  2245. ;    ------------------------------------------------------------------
  2246.  
  2247. RemoveSpecArticle:
  2248.     tst.w    wk_SpecArticleFlag(a4)
  2249.     beq.s    rsa_NoSpecialArticle
  2250.  
  2251.     clr.w    wk_SpecArticleFlag(a4)
  2252.  
  2253.     bsr    CountLines
  2254.     bsr    FindLines
  2255.  
  2256.     move.l    wk_SpecLineNum(a4),wk_CurrentLineNum(a4)
  2257.     move.l    wk_SpecOffset1Ptr(a4),wk_PageOffsetPtr(a4)
  2258.     move.l    wk_SpecOffset2Ptr(a4),wk_PageBufferPtr(a4)
  2259. rsa_NoSpecialArticle    
  2260.     bra    RefreshPage
  2261.  
  2262.  
  2263. ;    ==================================================================
  2264. ;    FUNCTION: GetKey
  2265. ;    USE:      To collect keypresses
  2266. ;    PARAMS:      None
  2267. ;    RESULT:      None
  2268. ;    ------------------------------------------------------------------
  2269.  
  2270.  
  2271. GetKey
  2272.     moveq    #0,d0
  2273.     move.b    $bfec01,d0    ; Get the key-byte
  2274.     beq.s    gk_NoKeyPressed
  2275.  
  2276.     ror.b    #1,d0        ; Decode the raw keycode...
  2277.     not    d0
  2278.  
  2279.     move.w    d0,wk_KeyBuffer(a4)
  2280.     clr.b    $bfec01        ; Got it, so clear old one..
  2281.  
  2282. gk_NoKeyPressed
  2283.     rts
  2284.  
  2285.  
  2286. ;    ==================================================================
  2287. ;    FUNCTION: PrintCoords
  2288. ;    USE:      Updates general text on the screen
  2289. ;    PARAMS:      None
  2290. ;    RESULT:      None
  2291. ;    ------------------------------------------------------------------
  2292.  
  2293.  
  2294. PrintCoords
  2295.     move.l    #0,wk_CharBuffer(a4)    ; Clear buffer to be used
  2296.     move.w    wk_SpriteXCoord(a4),d0    ; Get actual binary X coord
  2297.     bsr    ConvHexToAsc        ; Convert it
  2298.     bsr.s    PrintXCoord        ; Print it
  2299.  
  2300.     move.l    #0,wk_CharBuffer(a4)    ; Clear buffer for reuse
  2301.     move.w    wk_SpriteYCoord(a4),d0    ; Get actual binary Y coord
  2302.     bsr    ConvHexToAsc        ; Convert it
  2303.     bra.s    PrintYCoord        ; Print it
  2304.  
  2305. PrintKeyCode
  2306.     move.l    #0,wk_CharBuffer(a4)    ; Clear buffer for reuse
  2307.     move.w    wk_KeyBuffer(a4),d0    ; Get actual binary Y coord
  2308.     bsr    ConvHexToAsc        ; Convert it
  2309.     bsr    PrintKey        ; Print it
  2310.     rts
  2311.  
  2312. ;    ------------------------------------------------------------------
  2313.  
  2314. PrintYCoord
  2315.     moveq    #0,d0
  2316.     move.b    wk_CharBuffer+2(a4),d0    ; Get the second char of Y coord
  2317.     moveq    #21,d1            ; X coord
  2318.     moveq    #CursorYMaximum,d2    ; Y coord
  2319.     bsr    DrawCharacter        ; Print it
  2320.  
  2321.     moveq    #0,d0
  2322.     move.b    wk_CharBuffer+3(a4),d0    ; Get the third char of Y coord
  2323.     moveq    #22,d1            ; X coord
  2324.     moveq    #CursorYMaximum,d2    ; Y coord
  2325.     bra    DrawCharacter        ; Print it
  2326.  
  2327. PrintXCoord
  2328.     moveq    #0,d0
  2329.     move.b    wk_CharBuffer+2(a4),d0    ; Get second char of X coord
  2330.     moveq    #9,d1            ; X coord
  2331.     moveq    #CursorYMaximum,d2    ; Y coord
  2332.     bsr    DrawCharacter        ; Print it
  2333.  
  2334.     moveq    #0,d0
  2335.     move.b    wk_CharBuffer+3(a4),d0    ; Get third char of X coord
  2336.     moveq    #10,d1            ; X coord
  2337.     moveq    #CursorYMaximum,d2    ; Y coord
  2338.     bra    DrawCharacter        ; Print it
  2339.  
  2340. ;    ------------------------------------------------------------------
  2341.  
  2342. PrintKey
  2343.     moveq    #0,d0
  2344.     move.b    wk_CharBuffer+2(a4),d0    ; Get second char of KeyCode
  2345.     moveq    #34,d1            ; X coord
  2346.     moveq    #CursorYMaximum,d2    ; Y coord
  2347.     bsr    DrawCharacter        ; Print it
  2348.  
  2349.     moveq    #0,d0
  2350.     move.b    wk_CharBuffer+3(a4),d0    ; Get third char of KeyCode
  2351.     moveq    #35,d1            ; X coord
  2352.     moveq    #CursorYMaximum,d2    ; Y coord
  2353.     bra    DrawCharacter        ; Print it
  2354.  
  2355. ;    ------------------------------------------------------------------
  2356.  
  2357. PrintPageNumber
  2358.     moveq    #0,d0
  2359.     move.w    wk_CurrentNumber(a4),d0    ; Get the second char of Y coord
  2360.     ror.w    #8,d0
  2361.     and.w    #$00FF,d0
  2362.     moveq    #78,d1            ; X coord
  2363.     moveq    #00,d2            ; Y coord
  2364.     bsr    DrawCharacter        ; Print it
  2365.  
  2366.     moveq    #0,d0
  2367.     move.w    wk_CurrentNumber(a4),d0    ; Get the second char of Y coord
  2368.     and.w    #$00FF,d0
  2369.     moveq    #79,d1            ; X coord
  2370.     moveq    #00,d2            ; Y coord
  2371.     bra    DrawCharacter        ; Print it
  2372.  
  2373.  
  2374. ;    ==================================================================
  2375. ;    FUNCTION: ConvHexToAsc
  2376. ;    USE:      Converts a hex number to ascii
  2377. ;    PARAMS:      d0=Hex number
  2378. ;    RESULT:      Buffer=Ascii number
  2379. ;    ------------------------------------------------------------------
  2380.  
  2381. ConvHexToAsc
  2382.     lea    wk_CharBuffer(a4),a0
  2383.     ext.l    d0
  2384.  
  2385.     move    d0,d2
  2386.     lsr    #8,d2    
  2387.     lsr    #4,d2    
  2388.  
  2389.     bsr    pn_Nibble
  2390.  
  2391.     move.b    d2,0(a0)
  2392.     move    d0,d2
  2393.     lsr    #8,d2    
  2394.  
  2395.     bsr    pn_Nibble
  2396.  
  2397.     move.b    d2,1(a0)
  2398.     move    d0,d2
  2399.     lsr    #4,d2    
  2400.  
  2401.     bsr    pn_Nibble
  2402.  
  2403.     move.b    d2,2(a0)
  2404.     move    d0,d2
  2405.  
  2406.     bsr    pn_Nibble
  2407.  
  2408.     move.b    d2,3(a0)
  2409.     rts
  2410.  
  2411. pn_Nibble
  2412.     and    #%0000000000001111,d2
  2413.     add    #$30,d2
  2414.     cmp    #$3a,d2
  2415.     bcs    pn_ok
  2416.  
  2417.     add    #7,d2
  2418. pn_ok    rts
  2419.  
  2420.  
  2421. ;    ==================================================================
  2422. ;    FUNCTION: PrintNewText
  2423. ;    USE:      Prints text as from new page
  2424. ;    PARAMS:      a0=address of string (null terminated)
  2425. ;    RESULT:      Character printed on screen.
  2426. ;    ------------------------------------------------------------------
  2427.  
  2428.  
  2429. PrintNewText:
  2430.     clr.w    wk_CursXCoord(a4)
  2431.     move.w    #CursorYMinimum,wk_CursYCoord(a4)
  2432.  
  2433.  
  2434. ;    ==================================================================
  2435. ;    FUNCTION: PrintText
  2436. ;    USE:      Prints text at cursor X and Y coords.
  2437. ;    PARAMS:      a0=address of string (null terminated)
  2438. ;    RESULT:      Character printed on screen.
  2439. ;    ------------------------------------------------------------------
  2440.  
  2441.  
  2442. PrintText:
  2443.     move.l    a0,-(sp)
  2444.     bsr    ClearDoubleBuffer
  2445.     move.l    (sp)+,a0
  2446.  
  2447.     moveq    #0,d0
  2448.     moveq    #0,d1
  2449.     moveq    #0,d2
  2450. pt_PrintNextChar
  2451.     move.b    (a0)+,d0
  2452.     beq.s    pt_EndOfString
  2453.  
  2454. ;    ------------------------------------------------------------------
  2455.  
  2456.     cmp.b    #10,d0        ; EOL or carriage return
  2457.     beq.s    pt_IsNewLine
  2458.  
  2459. ;    ------------------------------------------------------------------
  2460.  
  2461.     cmp.b    #TAB,d0        ; Is it a TAB?
  2462.     beq.s    pt_IsTAB
  2463.  
  2464.     cmp.w    #(BytesPerLine-1),wk_CursXCoord(a4)
  2465.     ble.s    pt_StillInRHS    ; Because of 0-79==80
  2466.  
  2467. ;    ------------------------------------------------------------------
  2468.  
  2469.     sub.w    #(BytesPerLine-1),wk_CursXCoord(a4)
  2470.     addq.w    #1,wk_CursYCoord(a4)
  2471. pt_StillInRHS
  2472.     cmp.w    #CursorYMaximum,wk_CursYCoord(a4)
  2473.     bgt.s    pt_EndOfString
  2474.  
  2475. ;    ------------------------------------------------------------------
  2476.  
  2477.     move.w    wk_CursXCoord(a4),d1    ; Pass X and Y coords and also
  2478.     move.w    wk_CursYCoord(a4),d2    ; the character
  2479.     move.l    a0,-(sp)
  2480.     move.w    #'DB',d4        ; Draw characters - DBL Buffering
  2481.     bsr    DrawCharacter
  2482.     move.l    (sp)+,a0
  2483.  
  2484.     addq.w    #1,wk_CursXCoord(a4)    ; Move cursor across
  2485.  
  2486.     bra.s    pt_PrintNextChar    ; Print the next character
  2487.     
  2488. ;    ------------------------------------------------------------------
  2489.  
  2490. pt_EndOfString
  2491.     bra    ScrollMoreText        ; Copy Buffer to Display
  2492.  
  2493. ;    ------------------------------------------------------------------
  2494.  
  2495. pt_IsNewLine
  2496.     clr.w    wk_CursXCoord(a4)    ; Move cursor back to far LHS and
  2497.     addq.w    #1,wk_CursYCoord(a4)    ; one line down..
  2498.     bra.s    pt_PrintNextChar
  2499.  
  2500. ;    ------------------------------------------------------------------
  2501.  
  2502. pt_IsTAB
  2503.     move.w    wk_CursXCoord(a4),d3
  2504.     lsr.w    #3,d3        ; Divide the number of spaces by 8
  2505.     addq.w    #1,d3        ; Add a tab spacing..
  2506.     lsl.w    #3,d3        ; Multiply the number of tabs by 8
  2507.  
  2508.     move.w    #(BytesPerLine-1),d4
  2509.     cmp.w    d4,d3
  2510.     ble.s    ptt_IsMaximumXCoord
  2511.     move.w    d4,d3
  2512. ptt_IsMaximumXCoord
  2513.     move.w    d3,wk_CursXCoord(a4)
  2514.     bra.s    pt_PrintNextChar
  2515.  
  2516.  
  2517. ;    ==================================================================
  2518. ;    FUNCTION: PrintALine
  2519. ;    USE:      Prints a line of text at cursor X and Y coords.
  2520. ;    PARAMS:      a0=address of string
  2521. ;    RESULT:      Character printed on screen.
  2522. ;    ------------------------------------------------------------------
  2523.  
  2524. PrintALine:
  2525.     moveq    #0,d0
  2526.     moveq    #0,d1
  2527.     moveq    #0,d2
  2528.  
  2529. pal_PrintNextChar
  2530.     move.b    (a0)+,d0
  2531.     beq.s    pal_EndOfString
  2532.  
  2533. ;    ------------------------------------------------------------------
  2534.  
  2535.     cmp.b    #10,d0        ; EOL or carriage return
  2536.     beq.s    pal_IsNewLine
  2537.  
  2538. ;    ------------------------------------------------------------------
  2539.  
  2540.     cmp.b    #TAB,d0        ; Is TAB ???
  2541.     beq.s    pal_IsTAB
  2542.  
  2543. ;    ------------------------------------------------------------------
  2544.  
  2545.     cmp.w    #BytesPerLine-1,wk_CursXCoord(a4)  ; Because of 0-79==80 
  2546.     ble.s    pal_StillInRHS
  2547.     clr.w    wk_CursXCoord(a4)
  2548.     addq.w    #1,wk_CursYCoord(a4)
  2549.     bra.s    pal_IsNewLine
  2550.  
  2551. ;    ------------------------------------------------------------------
  2552.  
  2553. pal_StillInRHS
  2554.     cmp.w    #CursorYMaximum,wk_CursYCoord(a4)
  2555.     bgt.s    pal_EndOfString
  2556.  
  2557. ;    ------------------------------------------------------------------
  2558.  
  2559.     move.w    wk_CursXCoord(a4),d1
  2560.     move.w    wk_CursYCoord(a4),d2
  2561.     move.l    a0,-(sp)
  2562.     move.w    #'DB',d4
  2563.  
  2564.     bsr    DrawCharacter
  2565.  
  2566.     move.l    (sp)+,a0
  2567.     addq.w    #1,wk_CursXCoord(a4)
  2568.  
  2569.     bra.s    pal_PrintNextChar
  2570.     
  2571. ;    ------------------------------------------------------------------
  2572.  
  2573. pal_IsNewLine
  2574. pal_EndOfString
  2575.     rts
  2576.  
  2577. ;    ------------------------------------------------------------------
  2578.  
  2579. pal_IsTAB
  2580.     move.w    wk_CursXCoord(a4),d3
  2581.     lsr.w    #3,d3
  2582.     addq.w    #1,d3
  2583.     lsl.w    #3,d3
  2584.     move.w    #(BytesPerLine-1),d4
  2585.     cmp.w    d4,d3
  2586.     ble.s    palt_IsMaximumXCoord
  2587.     move.w    d4,d3
  2588. palt_IsMaximumXCoord
  2589.     move.w    d3,wk_CursXCoord(a4)
  2590.     bra.s    pal_PrintNextChar
  2591.  
  2592.  
  2593. ;    ======================================================================
  2594. ;    FUNCTION: PrintString
  2595. ;    USE:      Prints a string at specified X and Y coords.
  2596. ;    PARAMS:      a0=address of string (null terminated)
  2597. ;    RESULT:      Character printed on screen.
  2598. ;    ------------------------------------------------------------------
  2599.  
  2600. PrintString:
  2601.     moveq    #0,d0
  2602.     moveq    #0,d1            ; Clear registers the fast way
  2603.     moveq    #0,d2
  2604.     move.b    (a0)+,d0        ; Get cmd character
  2605.     cmp.b    #'@',d0            ; Is it the move cursor code?
  2606.     bne.s    ps_EndOfString
  2607.  
  2608. ;    ------------------------------------------------------------------
  2609.  
  2610.     move.b    (a0)+,d1        ; Right now get X coord
  2611.     move.b    (a0)+,d2        ;       then Y coord
  2612. ps_PrintNextChar
  2613.     moveq    #0,d0
  2614.     move.b    (a0)+,d0        ; Fetch next actual character
  2615.     beq.s    ps_EndOfString        ; If NULL then finished
  2616.  
  2617. ;    ------------------------------------------------------------------
  2618.  
  2619.     cmp.b    #10,d0            ; Is it CR
  2620.     beq.s    PrintString        ; If so start a new string
  2621.  
  2622.     move.l    a0,-(sp)
  2623.     movem.w    d1-d2,-(sp)        ; Save registers hopefully
  2624.  
  2625.     bsr    DrawCharacter
  2626.  
  2627.     movem.w    (sp)+,d1-d2        ; Get them back???
  2628.     move.l    (sp)+,a0
  2629.     addq.w    #1,d1            ; Increment X coord
  2630.  
  2631.     cmp.w    #BytesPerLine-1,d1    ; Are we past RHS
  2632.     ble.s    ps_StillInRHS        ; If not skip
  2633.  
  2634. ;    ------------------------------------------------------------------
  2635.  
  2636.     moveq    #0,d1            ; Otherwise reset X coord
  2637.     addq.w    #1,d2            ; And increment Y coord
  2638. ps_StillInRHS
  2639.     cmp.w    #CursorYMaximum+2,d2    ; Are we past BOS
  2640.     ble.s    ps_PrintNextChar    ; Is not loop
  2641.  
  2642. ;    ------------------------------------------------------------------
  2643.  
  2644. ps_EndOfString
  2645.     rts                ; Done
  2646.     
  2647.  
  2648. ;    ==================================================================
  2649. ;    FUNCTION: DrawCharacter
  2650. ;    USE:      Prints a character at specified X,Y coords.
  2651. ;    PARAMS:      d0=Character d1=XCoord d2=YCoord
  2652. ;    RESULT:      Character printed on screen.
  2653. ;    ------------------------------------------------------------------
  2654.  
  2655. ;    The significance of the x*BytesPerLine from below is to get the proper
  2656. ;    offset to handle lo-res and hires... and the significance of 192 is
  2657. ;    approximately the number of characters in the charset stored top line
  2658. ;    one after the other..
  2659.  
  2660. DrawCharacter    
  2661.     cmp.w    #'DB',d4
  2662.     bne.s    dc_IsOnBitplane
  2663.  
  2664. ;    ------------------------------------------------------------------
  2665.  
  2666.     moveq    #0,d4
  2667.     move.l    wk_DoubleBuffer(a4),a0
  2668.     bra.s    dc_GotPlaneAddress
  2669.  
  2670. ;    ------------------------------------------------------------------
  2671.  
  2672. dc_IsOnBitplane
  2673.     move.l    wk_Bitplane1(a4),a0    ; BitPlaneAddr
  2674. dc_GotPlaneAddress
  2675.     mulu    #ScreenWidth,d2        ; Get start of screen line
  2676.     add.w    d2,a0            ; Add to base of 1st bitplane
  2677.     add.w    d1,a0            ; Add the x-coord offset
  2678.     sub.w    #32,d0            ; ' ' := 32, is whitespace/first char
  2679.     lea    CharSet(pc),a1        ; in the font/charset
  2680.     add.w    d0,a1
  2681.     move.b    0*192(a1),0*BytesPerLine(a0)
  2682.     move.b    1*192(a1),1*BytesPerLine(a0)
  2683.     move.b    2*192(a1),2*BytesPerLine(a0)
  2684.     move.b    3*192(a1),3*BytesPerLine(a0)
  2685.     move.b    4*192(a1),4*BytesPerLine(a0)
  2686.     move.b    5*192(a1),5*BytesPerLine(a0)
  2687.     move.b    6*192(a1),6*BytesPerLine(a0)
  2688.     move.b    7*192(a1),7*BytesPerLine(a0)
  2689.     rts
  2690.  
  2691. ;    ==================================================================
  2692. ;    Button Resource Tables:
  2693. ;        These are used to determine which function the user is
  2694. ;    clicking on a button for.
  2695. ;    ------------------------------------------------------------------
  2696.  
  2697. CurrentButtonTable
  2698.     dc.l    DiskMagazine_BRT
  2699.  
  2700. ;    ------------------------------------------------------------------
  2701.  
  2702. DiskMagazine_BRT
  2703.     dc.w    0,0
  2704.     dc.w    640,256
  2705.     dc.l    Quit
  2706.  
  2707.     dc.w    0,0
  2708.     dc.w    0,0
  2709.     dc.l    0
  2710.  
  2711. ;    ======================================================================
  2712.  
  2713. CharSet    incdir    'Entropy:'
  2714.     incbin    'SGFont1.bin'
  2715. ;    incbin    'Binary/SGFont1.bin'    ; Charset/Font for magazine
  2716.     even
  2717.  
  2718. ;    ------------------------------------------------------------------
  2719. ;    Library names, but are the evens needed every time? Have to look it up
  2720.  
  2721. GfxName    dc.b    'graphics.library',0    ; For the copperlist.
  2722.     even
  2723.  
  2724. DosLibName
  2725.     dc.b    'dos.library',0        ; For file handling.
  2726.     even
  2727.  
  2728. IntuiName
  2729.     dc.b    'intuition.library',0    ; For AutoRequest patching.
  2730.     even
  2731.  
  2732. ;    ======================================================================
  2733.  
  2734. IndexName
  2735.     dc.b    'Entropy:Index.FLT',0
  2736.  
  2737. IndexTitle
  2738.     dc.b    'The Index - Press the help key for the help page...',0
  2739.  
  2740. IndexPageNum
  2741.     dc.b    '@',78,2
  2742.     dc.b    '00',0
  2743.  
  2744. ;    ------------------------------------------------------------------
  2745.  
  2746. BlankTitle
  2747.     dc.b    '@',07,CursorYMaximum+2
  2748.     dc.b    '                                                                   ',0
  2749.  
  2750. TitleName
  2751.     dc.b    'Entropy:Page00.txt',0
  2752.  
  2753. ;    ------------------------------------------------------------------
  2754. ;    This following string is used for the general storage of page filenames
  2755. ;    the numbers are obviously inserted in the 'Buffer' bit..
  2756.  
  2757. TextName
  2758.     dc.b    'Entropy:Page'
  2759. TextNumberBuffer
  2760.     dc.b    '  .txt',0
  2761.     even
  2762.  
  2763. ;    ------------------------------------------------------------------
  2764. ;    Temporary buffer for the workspace memory address so we can snarf it
  2765. ;    for use in interrupts, (We had a problem there ;-)
  2766.  
  2767. MemAddress:
  2768.     dc.l    0
  2769.  
  2770. ;    ======================================================================
  2771.  
  2772. VersionString
  2773.     dc.b    '$VER:  ENTROPY DiskMag V2.01 by Soltan Gris (08/11/94)',0
  2774.     even
  2775.  
  2776. ;    ------------------------------------------------------------------
  2777.  
  2778. TitleText
  2779.     dc.b    '@',(BytesPerLine-44)/2,4    ; Centered text, 44=length
  2780.     dc.b    'A Soltan Gris production for Entropy in 1994',0
  2781.  
  2782. ;    ======================================================================
  2783.  
  2784. HelpTxt
  2785.     dc.b    '------------------------------------------------------------------------------',10
  2786.     dc.b    '  _   _  ____  _     ___',10
  2787.     dc.b    ' | |_| || ___|| |   |_  \  _        Entropy Diskmag V2.01          08/11/94',10
  2788.     dc.b    ' |     ||__/  | |    _|  ||_|',10
  2789.     dc.b    ' |  _  | ____ | |__ |  _/  _                 Coded in 100% Assembler by:',10
  2790.     dc.b    ' |_| |_||____||____||_|   |_|                  -+= Soltan Gris =+-',10,10
  2791.     dc.b    '------------------------------------------------------------------------------',10
  2792.     dc.b    '                Keyboard Commands:',10
  2793.     dc.b    '------------------------------------------------------------------------------',10,10
  2794.     dc.b    '        Help    - This page    F08    - My Messages/Adds',10
  2795.     dc.b    '        Escape    - Exit        F09    - Reload index page',10
  2796.     dc.b    '                    F10    - Refresh page',10,10
  2797.     dc.b    '        Left Mouse        - Exit',10
  2798.     dc.b    '        Right Mouse        - Exit',10
  2799.     dc.b    '        Up Cursor Key        - Scroll one line up',10
  2800.     dc.b    '        Down Cursor Key        - Scroll one line down',10
  2801.     dc.b    '        Left Cursor Key        - Next page',10
  2802.     dc.b    '        Right Cursor Key    - Previous page',10,10
  2803.     dc.b    '------------------------------------------------------------------------------',10,10
  2804.     dc.b    '      The top row number keys can be used to select page numbers and are',10
  2805.     dc.b    '   taken in succession. The numbers can be viewed on the top right of the',10
  2806.     dc.b    '   titlebar, second line down. If the file corresponding to  a number does',10
  2807.     dc.b    '   not exist then you will be left on the page you were already on.',10,10
  2808.     dc.b    '   To get my address, see some adds, read some messages etc, try the F8',10
  2809.     dc.b    '   the F8 function (Just press the damn key....',10,10
  2810.     dc.b    '                        Yours Soltan.....',10,10
  2811.     dc.b    '------------------------------------------------------------------------------',0
  2812.  
  2813. ;    ------------------------------------------------------------------
  2814.  
  2815. SoltanGrisTxt
  2816.     dc.b    '------------------------------------------------------------------------------',10
  2817.     dc.b    '  _   _   _    ___   __',10
  2818.     dc.b    ' | | | | | |  / __| /  \  _        Entropy Diskmag V2.01          08/11/94',10
  2819.     dc.b    ' | | |  \| | |  __|| /  ||_|',10
  2820.     dc.b    ' | | | |\  | | |   |  / | _               Coded in 100% Assembler by:',10
  2821.     dc.b    ' |_| |_| |_| |/     \__/ |_|                  -+= Soltan Gris =+-',10,10
  2822.     dc.b    '------------------------------------------------------------------------------',10
  2823.     dc.b    '                About this Program:',10
  2824.     dc.b    '------------------------------------------------------------------------------',10,10
  2825.     dc.b    '    If you''re wondering why this program is titled "Entropy", it is for',10
  2826.     dc.b    '  for lack of a better name, suggestions are welcome and can be given/sent',10
  2827.     dc.b    '  whatever to Jericho at the usual postal address for Entropy, as to the',10
  2828.     dc.b    '  address, I don''t have it with me so I can''t put it here for you...',10,10
  2829.     dc.b    '    This diskmag has been approximately half a year in the making!!!!',10
  2830.     dc.b    '  You may be wondering how it took that long to code it, well it didn''t really',10
  2831.     dc.b    '  what caused the big wait was the lack of a computer.... and also a year',10
  2832.     dc.b    '  ( maybe wasted :-) at a tertiary institution.',10,10
  2833.     dc.b    '    Some information about the program:',10
  2834.     dc.b    '    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^',10
  2835.     dc.b    '  Source code size:            12419 lines,    61182 bytes.',10
  2836.     dc.b    '  Binary size:                15998 bytes.',10
  2837.     dc.b    '  Other included binaries are:        The font, and the logo.',10,10
  2838.     dc.b    '  Assembler used:            Devpac 2, Trash''m''one V?.??',10,10
  2839.     dc.b    '    Bugs remaining:',10
  2840.     dc.b    '    ^^^^^^^^^^^^^^^',10
  2841.     dc.b    '    The only error remaining that I am aware of is, in requester/error',10
  2842.     dc.b    '  handling in Kickstart 3.1, I''m not sure if Kickstart 2.04 has the same',10
  2843.     dc.b    '  problem, as I have been working in 1.3, and 3.1 and my 2.04 chip is in',10
  2844.     dc.b    '  storage..',10,10
  2845.     dc.b    '      If you discover any bugs, I may have found and forgotten or not even',10
  2846.     dc.b    '  known about please contact me about it, in the address I have supplied.',10,10
  2847.     dc.b    '------------------------------------------------------------------------------',10
  2848.     dc.b    '                My Advertisements:',10
  2849.     dc.b    '------------------------------------------------------------------------------',10,10
  2850.     dc.b    '  o    If you want to swap demos, intros or trainers, ripped from games or',10
  2851.     dc.b    '    whatever, feel free to contact me',10,10
  2852.     dc.b    '  o    If you want to swap disk magazines (not the disks you get with mags',10
  2853.     dc.b    '    like Amiga Shopper!!. The ones by crackers/demo groups are the ones',10
  2854.     dc.b    '    I want e.g Crackers Journal, Stolen Data, Tech Times, LSD Grapevine..',10
  2855.     dc.b    '    with me, send a list, 100% reply rate...',10,10
  2856.     dc.b    '  o    Do you want help with your assembler source codes, to swap assemblers',10
  2857.     dc.b    '    swap source codes, coding tips etc.. fell free to write..',10,10
  2858.     dc.b    '------------------------------------------------------------------------------',10
  2859.     dc.b    '                    My Address:',10
  2860.     dc.b    '------------------------------------------------------------------------------',10,10
  2861.     dc.b    '  Permanent contact address:',10
  2862.     dc.b    '  ^^^^^^^^^^^^^^^^^^^^^^^^^^',10
  2863.     dc.b    '            Soltan Gris,',10
  2864.     dc.b    '            Richard Tew,',10
  2865.     dc.b    '            146 Alford Forest Road,',10
  2866.     dc.b    '            Ashburton,',10
  2867.     dc.b    '            New Zealand.',10,10
  2868.     dc.b    '  E-Mail Addresses:',10
  2869.     dc.b    '  ^^^^^^^^^^^^^^^^^',10
  2870.     dc.b    '    I have 1 NZ email address and 3 overseas, but the only one I can',10
  2871.     dc.b    '  is:-            misc206@csc.canterbury.ac.nz',10
  2872.     dc.b    '  and it should be usable for the next couple of years... ( I Hope!! )',10
  2873.     dc.b    '                        Ave,',10
  2874.     dc.b    '                            Soltan 12/11/94.',10,10
  2875.     dc.b    '------------------------------------------------------------------------------',0
  2876.  
  2877. ;    ======================================================================
  2878.  
  2879. EntropyTitleCTxt
  2880.     dc.b    '@',71,00
  2881.     dc.b    'Page: #--',10
  2882.     dc.b    '@',0,CursorYMaximum+2
  2883.     dc.b    'Title: Loading index file and sorting....',0
  2884.  
  2885. PageNumbersCTxt
  2886.     dc.b    '@',78,00
  2887. PageNumBuffer
  2888.     dc.b    '  ',0
  2889.  
  2890. ;    ======================================================================
  2891. ;    In progress messages:
  2892.  
  2893. ReadingFile1Txt
  2894.     dc.b    'Proceeding to read in file: ',0
  2895. ReadingFile2Txt
  2896.     dc.b    '...',10,0
  2897. LockTxt
  2898.     dc.b    '  Attempting to lock file',10,0
  2899. ExamineTxt
  2900.     dc.b    '  Examining file',10,0
  2901. UnLockTxt
  2902.     dc.b    '  Unlocking file',10,0
  2903. OpenTxt
  2904.     dc.b    '  Attempting to open file',10,0
  2905. ReadTxt
  2906.     dc.b    '  Reading data....',10,0
  2907. CloseTxt
  2908.     dc.b    '  Closing file',10,0
  2909. ReadyTxt
  2910.     dc.b    'Ready.',10,10,0
  2911.  
  2912. AutoRequestTxt
  2913.     dc.b    10,'AutoRequest:  ',0
  2914. LeftButtonTxt
  2915.     dc.b    10,'LEFT  button: ',0
  2916. RightButtonTxt
  2917.     dc.b    10,'RIGHT button: ',0
  2918. RequesterChoiceTxt
  2919.     dc.b    10,10,'Please select the appropriate choice by pressing your left or right mouse button',10,10,0
  2920.  
  2921. ProgramDataCTxt
  2922.     dc.b    '@',00,CursorYMaximum
  2923.     dc.b    'MouseX: $',10
  2924.     dc.b    '@',12,CursorYMaximum
  2925.     dc.b    'MouseY: $',10
  2926.     dc.b    '@',24,CursorYMaximum
  2927.     dc.b    'KeyCode: $',0
  2928.  
  2929. ;    ======================================================================
  2930. ;    Error Messages:
  2931.  
  2932. DosErrorCTxt
  2933.     dc.b    '@',00,CursorYMinimum
  2934.     dc.b    'Internal Error #01: Unable to open dos. library',10
  2935.     dc.b    '@',00,CursorYMinimum+1
  2936.     dc.b    '-> This utility will quit in 10 seconds...',0
  2937.  
  2938. FileLockErrTxt
  2939.     dc.b    'Internal Error #02: Unable to locate file',10
  2940.     dc.b    'Is the volume Entropy: available? (either in the drive or assigned)',10,0
  2941.  
  2942. FileExamErrTxt
  2943.     dc.b    'Internal Error #03: Unable to examine file',10,0
  2944.  
  2945. NoFileMemErrTxt
  2946.     dc.b    'Internal Error #04: Unable to allocate file buffer',10,0
  2947.  
  2948. FileOpenErrTxt
  2949.     dc.b    'Internal Error #05: Unable to open file',10,0
  2950.  
  2951. NotIndexFileErrCTxt
  2952.     dc.b    '@',00,CursorYMinimum
  2953.     dc.b    'Internal Error #06: Not an index file',10
  2954.     dc.b    '@',00,CursorYMinimum+1
  2955.     dc.b    ' The index file has been tampered with!!!',10
  2956.     dc.b    '@',00,CursorYMinimum+2
  2957.     dc.b    ' Releasing virus into memory.......',0
  2958.  
  2959. IndexErrTxt
  2960.     dc.b    10,'Internal Error #07: Unable to load Index file',0
  2961.     even
  2962.  
  2963. ;    ======================================================================
  2964.  
  2965.     SECTION    Gfx,DATA_C
  2966.  
  2967. CopperList
  2968.     Mov    %1100001000000000,bplcon0
  2969.     Mov    0,bplcon1
  2970.     Mov    0,bpl1mod
  2971.     Mov    0,bpl2mod
  2972.     Mov    $003C,ddfstrt
  2973.     Mov    $00D4,ddfstop
  2974.     Mov    $2C81,diwstrt
  2975.     Mov    $2CC1,diwstop
  2976. CopperListColors
  2977.     Mov    $029,color00
  2978.     Mov    $0FFF,color01
  2979.     Mov    $0FEF,color02
  2980.     Mov    $0EDE,color03
  2981.     Mov    $0DCD,color04
  2982.     Mov    $0CBC,color05
  2983.     Mov    $0BAB,color06
  2984.     Mov    $0A9A,color07
  2985.     Mov    $0989,color08
  2986.     Mov    $0878,color09
  2987.     Mov    $0768,color10
  2988.     Mov    $0657,color11
  2989.     Mov    $0546,color12
  2990.     Mov    $0435,color13
  2991.     Mov    $0324,color14
  2992.     Mov    $0213,color15
  2993.     Mov    $0000,color16
  2994.     Mov    $0000,color17
  2995.     Mov    $0000,color18
  2996.     Mov    $0000,color19
  2997.     Mov    $0000,color20
  2998.     Mov    $0000,color21
  2999.     Mov    $0000,color22
  3000.     Mov    $0000,color23
  3001.     Mov    $0000,color24
  3002.     Mov    $0000,color25
  3003.     Mov    $0000,color26
  3004.     Mov    $0000,color27
  3005.     Mov    $0000,color28
  3006.     Mov    $0000,color29
  3007.     Mov    $0000,color30
  3008.     Mov    $0000,color31
  3009.  
  3010. CprSpr1
  3011.     Mov    0,spr0pth
  3012.     Mov    0,spr0ptl
  3013. CprSpr2
  3014.     Mov    0,spr1pth
  3015.     Mov    0,spr1ptl
  3016. CprSpr3
  3017.     Mov    0,spr2pth
  3018.     Mov    0,spr2ptl
  3019. CprSpr4
  3020.     Mov    0,spr3pth
  3021.     Mov    0,spr3ptl
  3022. CprSpr5
  3023.     Mov    0,spr4pth
  3024.     Mov    0,spr4ptl
  3025. CprSpr6
  3026.     Mov    0,spr5pth
  3027.     Mov    0,spr5ptl
  3028. CprSpr7
  3029.     Mov    0,spr6pth
  3030.     Mov    0,spr6ptl
  3031. CprSpr8
  3032.     Mov    0,spr7pth
  3033.     Mov    0,spr7ptl
  3034.  
  3035. CprPln1
  3036.     Mov    0,bpl1pth
  3037.     Mov    0,bpl1ptl
  3038. CprPln2
  3039.     Mov    0,bpl2pth
  3040.     Mov    0,bpl2ptl
  3041. CprPln3
  3042.     Mov    0,bpl3pth
  3043.     Mov    0,bpl3ptl
  3044. CprPln4
  3045.     Mov    0,bpl4pth
  3046.     Mov    0,bpl4ptl
  3047.  
  3048.     Wait    007,88
  3049.     Mov    $FFF,color00        ; Draw start-of-text white line
  3050.     Wait    007,89
  3051.  
  3052.     Mov    $0000,color00        ; Main text bit......
  3053.     Mov    $0FFF,color01
  3054.     Mov    $0FFF,color02
  3055.  
  3056.     Wait    224,255            ; Wait to get into PAL screen area
  3057.  
  3058.     Wait    007,021
  3059.     Mov    $FFF,color00        ; Draw end-of-text white line
  3060.     Wait    007,022
  3061.  
  3062.     Mov    $029,color00        ; Start outside color
  3063.  
  3064.     Wait    254,255            ; End-of-copper wait, twice for
  3065.     Wait    254,255            ; safety....
  3066.  
  3067. ;    ======================================================================
  3068.  
  3069. SpriteData
  3070.     dc.l    $9A88B700        ; Coolest mouse pointer, tho the old
  3071. MouseData
  3072.     dc.l    $C0004000        ; hand one I used to get with pirated
  3073.     dc.l    $7000B000        ; software from copysoft was pretty
  3074.     dc.l    $3C004C00        ; snazzy... ;-)
  3075.     dc.l    $3F004300
  3076.     dc.l    $1FC020C0
  3077.     dc.l    $1FC02000
  3078.     dc.l    $0F001100
  3079.     dc.l    $0D801280
  3080.     dc.l    $04C00940
  3081.     dc.l    $046008A0
  3082.     dc.l    $00200040,0,0
  3083.  
  3084. ;    ======================================================================
  3085. ;    Gfx Binary Files:
  3086.  
  3087.  
  3088. EntropyLogo                ; Snazzy title, of 'Entropy'
  3089.     incbin    'ENTY.bin'
  3090. ;    incbin    'binary/enty.bin'    ; Where oh where have my binaries gone?
  3091.                     ; Hey, you're not in DMClone now Dr
  3092.                     ; Ropata!
  3093.  
  3094.